FROM python:3.11-slim WORKDIR /app COPY . . RUN pip install --upgrade pip # Install CPU-only torch/torchvision explicitly (avoids pulling ~2GB+ of unused NVIDIA/CUDA packages) RUN pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu RUN pip install -r requirements.txt # Bake both AI models into the image at build time (avoids cold-start timeout # on the first real user request after a deploy) RUN python prefetch_models.py EXPOSE 7860 CMD ["uvicorn","main:app","--host","0.0.0.0","--port","7860"]