vhr1007 commited on
Commit
baa9d72
1 Parent(s): c7e9ccf
Files changed (3) hide show
  1. Dockerfile +8 -7
  2. app.py +1 -1
  3. requirements.txt +47 -2
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  # Base image
2
- FROM python:3.8-slim
3
 
4
  # Set working directory
5
  WORKDIR /app
@@ -9,12 +9,13 @@ WORKDIR /app
9
  RUN apt-get update && apt-get install -y git
10
 
11
  # Copy requirements.txt and install dependencies
12
- COPY requirements.txt .
13
- RUN pip install --no-cache-dir -r requirements.txt
14
 
15
- # Copy the rest of the application code
16
- COPY . .
17
 
 
 
18
 
19
- # Command to run the FastAPI application
20
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # Base image
2
+ FROM python:3.10.9
3
 
4
  # Set working directory
5
  WORKDIR /app
 
9
  RUN apt-get update && apt-get install -y git
10
 
11
  # Copy requirements.txt and install dependencies
12
+ RUN mkdir -p /app/.cache/huggingface
 
13
 
14
+ # Copy the current directory contents into the container at /app
15
+ COPY . /app
16
 
17
+ # Install requirements.txt
18
+ RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
19
 
20
+ # Start the FastAPI app on port 7860, the default port expected by Spaces
21
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
app.py CHANGED
@@ -48,7 +48,7 @@ if not qdrant_url or not access_token:
48
  # Initialize the SentenceTransformer model with the cache directory managed by HF_HOME
49
  try:
50
  cache_folder = os.path.join(hf_home_dir, "transformers_cache")
51
- encoder = SentenceTransformer('nomic-ai/nomic-embed-text-v1.5', cache_folder=cache_folder, trust_remote_code=True)
52
  logging.info("Successfully loaded the SentenceTransformer model.")
53
  except Exception as e:
54
  logging.error(f"Failed to load the SentenceTransformer model: {e}")
 
48
  # Initialize the SentenceTransformer model with the cache directory managed by HF_HOME
49
  try:
50
  cache_folder = os.path.join(hf_home_dir, "transformers_cache")
51
+ encoder = SentenceTransformer('nomic-ai/nomic-embed-text-v1.5', cache_folder=cache_folder)
52
  logging.info("Successfully loaded the SentenceTransformer model.")
53
  except Exception as e:
54
  logging.error(f"Failed to load the SentenceTransformer model: {e}")
requirements.txt CHANGED
@@ -2,8 +2,53 @@ fastapi==0.78.0
2
  uvicorn==0.17.6
3
  pandas==1.3.5
4
  qdrant-client==0.9.2
5
- sentence-transformers==2.2.2
6
  openai
7
  PyJWT==2.6.0
8
  python-dotenv==0.19.2
9
- nltk==3.6.7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  uvicorn==0.17.6
3
  pandas==1.3.5
4
  qdrant-client==0.9.2
 
5
  openai
6
  PyJWT==2.6.0
7
  python-dotenv==0.19.2
8
+ nltk==3.6.7
9
+ ydantic==2.8.2
10
+ pydantic_core==2.20.1
11
+ Pygments==2.18.0
12
+ pypdf==4.3.1
13
+ pytesseract==0.3.10
14
+ python-dateutil==2.9.0.post0
15
+ python-dotenv==1.0.1
16
+ python-multipart==0.0.9
17
+ pytz==2024.1
18
+ PyYAML==6.0.1
19
+ qdrant-client==1.10.1
20
+ regex==2024.7.24
21
+ requests==2.32.3
22
+ rich==13.7.1
23
+ s3transfer==0.10.2
24
+ safetensors==0.4.3
25
+ scikit-learn==1.5.1
26
+ scipy==1.14.0
27
+ sentence-transformers==3.0.1
28
+ setuptools==70.3.0
29
+ shellingham==1.5.4
30
+ six==1.16.0
31
+ sniffio==1.3.1
32
+ soupsieve==2.5
33
+ SQLAlchemy==2.0.31
34
+ starlette==0.37.2
35
+ striprtf==0.0.26
36
+ sympy==1.13.1
37
+ tenacity==8.5.0
38
+ threadpoolctl==3.5.0
39
+ tiktoken==0.7.0
40
+ tokenizers==0.19.1
41
+ torch==2.4.0
42
+ tqdm==4.66.4
43
+ transformers==4.43.3
44
+ typer==0.12.3
45
+ typing-inspect==0.9.0
46
+ typing_extensions==4.12.2
47
+ tzdata==2024.1
48
+ urllib3==2.2.2
49
+ uvloop==0.19.0
50
+ watchfiles==0.22.0
51
+ websockets==12.0
52
+ wrapt==1.16.0
53
+ xxhash==3.4.1
54
+ yarl==1.9.4