Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -11
Dockerfile
CHANGED
|
@@ -1,21 +1,22 @@
|
|
| 1 |
-
# 1.
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
# 2. Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# 3. Install
|
| 8 |
-
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
|
|
|
| 9 |
|
| 10 |
-
# 4.
|
| 11 |
-
|
|
|
|
| 12 |
|
| 13 |
-
# 5.
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
# 7. Expose port
|
| 18 |
EXPOSE 7860
|
| 19 |
|
| 20 |
-
#
|
| 21 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# 1. Base Image
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
# 2. Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# 3. Install dependencies (Pre-downloading the NEW model we discussed)
|
| 8 |
+
RUN pip install --no-cache-dir fastapi uvicorn transformers pillow pydantic requests torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
| 9 |
+
RUN python -c "from transformers import pipeline; pipeline('image-classification', model='prithivMLmods/deepfake-detector-model-v1')"
|
| 10 |
|
| 11 |
+
# 4. Copy your app.py specifically into the current WORKDIR (/app)
|
| 12 |
+
# This ensures uvicorn can find the "app" module
|
| 13 |
+
COPY app.py /app/app.py
|
| 14 |
|
| 15 |
+
# 5. Set environment variable to make sure Python finds the /app folder
|
| 16 |
+
ENV PYTHONPATH=/app
|
| 17 |
+
|
| 18 |
+
# 6. Expose port
|
|
|
|
| 19 |
EXPOSE 7860
|
| 20 |
|
| 21 |
+
# 7. Start the node - using the full path to be safe
|
| 22 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|