FROM python:3.11-slim WORKDIR /app # Install system deps RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ && rm -rf /var/lib/apt/lists/* # Install CPU-only PyTorch first (much smaller than full CUDA build) RUN pip install --no-cache-dir \ torch==2.2.2+cpu \ torchvision==0.17.2+cpu \ --index-url https://download.pytorch.org/whl/cpu # Install remaining dependencies COPY requirements-deploy.txt . RUN pip install --no-cache-dir -r requirements-deploy.txt # Download model weights at build time from Hugging Face RUN mkdir -p weights && \ curl -L -o weights/advanced_model_best.pth \ https://huggingface.co/Aredeksu/SensiNet-Mammography/resolve/main/advanced_model_best.pth # Copy application code COPY app/ app/ # Hugging Face Spaces expects port 7860 ENV MODEL_MODE=real \ MODEL_VERSION=sensinet-v1 \ PORT=7860 EXPOSE 7860 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]