# Minimal image to serve the trained pipeline with FastAPI FROM python:3.11-slim WORKDIR /app # Pin runtime deps (match training!) RUN pip install --no-cache-dir \ fastapi==0.115.* \ "uvicorn[standard]==0.30.*" \ joblib==1.4.2 \ numpy==1.26.* \ pandas==2.2.* \ scikit-learn==1.6.1 # <= match your training version COPY app.py diabetes_model.pkl /app/ EXPOSE 7860 # IMPORTANT: bind to the port Spaces provides CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-7860} --workers 1 --timeout-keep-alive 120"]