| FROM python:3.10-slim | |
| WORKDIR /app | |
| # System dependencies for OpenCV and others | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy App and Model | |
| COPY app.py . | |
| COPY api.py . | |
| COPY best.pt . | |
| # Expose the default HF Space port | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| # Run the FastAPI app with Uvicorn | |
| CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"] |