PunchNFIT
commited on
Commit
·
8d22a8e
1
Parent(s):
4c54de5
Fix Flask dependency and Dockerfile syntax
Browse files- Dockerfile +13 -10
- requirements.txt +5 -6
Dockerfile
CHANGED
|
@@ -1,21 +1,24 @@
|
|
| 1 |
-
#
|
|
|
|
| 2 |
FROM huggingface/transformers-pytorch-cpu:latest
|
| 3 |
|
| 4 |
# Set working directory inside the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Copy
|
| 8 |
-
COPY .
|
| 9 |
|
| 10 |
-
# Install dependencies
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
-
#
|
|
|
|
|
|
|
|
|
|
| 14 |
EXPOSE 7860
|
| 15 |
|
| 16 |
-
# Set environment
|
| 17 |
-
ENV
|
| 18 |
-
ENV PYTHONUNBUFFERED=1
|
| 19 |
|
| 20 |
-
# Run
|
| 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 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
numpy
|
| 7 |
scikit-learn
|
| 8 |
-
|
|
|
|
| 1 |
+
# requirements.txt
|
| 2 |
+
torch
|
| 3 |
+
transformers
|
| 4 |
+
sentence-transformers
|
| 5 |
+
flask
|
| 6 |
numpy
|
| 7 |
scikit-learn
|
|
|