FROM python:3.11-slim WORKDIR /code # Install system dependencies for Pillow/image processing RUN apt-get update && apt-get install -y --no-install-recommends \ libgl1 \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies first (layer caching) COPY requirements.txt . RUN pip install --no-cache-dir --timeout 120 -r requirements.txt # Copy model and application code COPY MobileNetV2_final.keras . COPY app.py . # Expose port 7860 for Hugging Face Spaces EXPOSE 7860 # Run uvicorn on port 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]