Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +7 -5
Dockerfile
CHANGED
|
@@ -6,16 +6,18 @@ WORKDIR /app
|
|
| 6 |
|
| 7 |
# 3. Install PyTorch (CPU version to save massive space/RAM) and required libraries
|
| 8 |
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
| 9 |
-
RUN pip install --no-cache-dir fastapi uvicorn transformers pillow pydantic
|
| 10 |
|
| 11 |
-
# 4.
|
|
|
|
|
|
|
|
|
|
| 12 |
RUN python -c "from transformers import pipeline; pipeline('image-classification', model='dima806/chest_xray_pneumonia_detection')"
|
| 13 |
|
| 14 |
-
#
|
| 15 |
COPY app.py .
|
| 16 |
|
| 17 |
-
#
|
| 18 |
EXPOSE 7860
|
| 19 |
|
| 20 |
-
#
|
| 21 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 6 |
|
| 7 |
# 3. Install PyTorch (CPU version to save massive space/RAM) and required libraries
|
| 8 |
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
|
|
|
| 9 |
|
| 10 |
+
# 4. Install API and networking dependencies (requests added here!)
|
| 11 |
+
RUN pip install --no-cache-dir fastapi uvicorn transformers pillow pydantic requests
|
| 12 |
+
|
| 13 |
+
# 5. THE CHEAT CODE: Pre-download the heavy model weights during the build phase
|
| 14 |
RUN python -c "from transformers import pipeline; pipeline('image-classification', model='dima806/chest_xray_pneumonia_detection')"
|
| 15 |
|
| 16 |
+
# 6. Copy your FastAPI code into the container
|
| 17 |
COPY app.py .
|
| 18 |
|
| 19 |
+
# 7. Expose the exact port Hugging Face Spaces requires
|
| 20 |
EXPOSE 7860
|
| 21 |
|
| 22 |
+
# 8. Start the node
|
| 23 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|