Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system dependencies required for OpenCV and ONNX | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements and install | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy all backend files into the container | |
| COPY . . | |
| # Download the ONNX model inside the cloud container | |
| RUN python download_model.py | |
| # Expose the port FastAPI runs on | |
| EXPOSE 7860 | |
| # Command to run the application (Hugging Face Spaces expects 0.0.0.0) | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |