ml-research-platform / Dockerfile
unknown
feat: add 4 new models — X-ray/Grad-CAM, YOLO animals, Food ViT, Bird EfficientNetB2
6265635
Raw
History Blame Contribute Delete
847 Bytes
FROM python:3.11-slim
WORKDIR /app
# System dependencies required by opencv-python-headless (ultralytics transitive dep)
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu && \
pip install --no-cache-dir -r requirements.txt
# Pre-bake YOLOv8n weights (6MB) so first request doesn't block
RUN python -c "from ultralytics import YOLO; YOLO('yolov8n.pt')"
# HuggingFace cache directory for transformers + torchxrayvision
ENV HF_HOME=/app/.hf-cache \
TORCH_HOME=/app/.torch-cache
# Copy app files
COPY . .
# HF Spaces requires port 7860
EXPOSE 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]