| # Use a lightweight Python image | |
| FROM python:3.9-slim | |
| # Set working directory | |
| WORKDIR /code | |
| # Install dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy app code and models | |
| COPY app/ /code/app | |
| # Set environment variable for Hugging Face Spaces | |
| ENV HOST 0.0.0.0 | |
| ENV PORT 7860 | |
| # Expose port | |
| EXPOSE 7860 | |
| # Run FastAPI app with Uvicorn | |
| CMD ["uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "7860"] | |