PunchNFIT commited on
Commit
8d22a8e
·
1 Parent(s): 4c54de5

Fix Flask dependency and Dockerfile syntax

Browse files
Files changed (2) hide show
  1. Dockerfile +13 -10
  2. requirements.txt +5 -6
Dockerfile CHANGED
@@ -1,21 +1,24 @@
1
- # Use a minimal Hugging Face base image with PyTorch and Transformers
 
2
  FROM huggingface/transformers-pytorch-cpu:latest
3
 
4
  # Set working directory inside the container
5
  WORKDIR /app
6
 
7
- # Copy model and code files into the container
8
- COPY . /app
9
 
10
- # Install dependencies
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
- # Expose port for inference API
 
 
 
14
  EXPOSE 7860
15
 
16
- # Set environment variables (optional)
17
- ENV HF_HOME=/root/.cache/huggingface
18
- ENV PYTHONUNBUFFERED=1
19
 
20
- # Run the inference script
21
- CMD ["python", "api_inference.py"]
 
1
+ # Dockerfile
2
+ # Use the base image you selected
3
  FROM huggingface/transformers-pytorch-cpu:latest
4
 
5
  # Set working directory inside the container
6
  WORKDIR /app
7
 
8
+ # Copy the requirements file first
9
+ COPY requirements.txt .
10
 
11
+ # Install dependencies from your *fixed* requirements.txt
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
+ # Copy all your model files and scripts into the container
15
+ COPY . .
16
+
17
+ # Expose the port your Flask app runs on
18
  EXPOSE 7860
19
 
20
+ # Set environment variable to trust your custom code
21
+ ENV HF_TRUST_REMOTE_CODE=true
 
22
 
23
+ # Run your api_inference.py script
24
+ CMD ["python", "api_inference.py"]
requirements.txt CHANGED
@@ -1,8 +1,7 @@
1
- torch==2.8.0
2
- transformers==4.31.0
3
- sentence-transformers==2.2.2
4
- fastapi
5
- uvicorn
6
  numpy
7
  scikit-learn
8
-
 
1
+ # requirements.txt
2
+ torch
3
+ transformers
4
+ sentence-transformers
5
+ flask
6
  numpy
7
  scikit-learn