FROM python:3.10 WORKDIR /app # Install system dependencies (OpenCV, Glib, and other libraries) RUN apt-get update && apt-get install -y \ libgl1-mesa-glx \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy your FastAPI code and model COPY app.py /app/ COPY model /app/model COPY requirements.txt /app/ # Expose the default Spaces port EXPOSE 7860 # Start FastAPI (using uvicorn) ENV PORT 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]