FROM python:3.11-slim # System deps for opencv, pillow, etc. RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ libgl1 \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender1 \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # HF Spaces writable cache locations ENV HF_HOME=/tmp/huggingface ENV TRANSFORMERS_CACHE=/tmp/huggingface ENV TORCH_HOME=/tmp/torch ENV PYTHONUNBUFFERED=1 WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt COPY . . # HF Spaces expects port 7860 EXPOSE 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]