FROM python:3.9-slim # --- Install system dependencies --- RUN apt-get update && apt-get install -y \ git \ gcc \ g++ \ build-essential \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender-dev \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # --- Set environment variables --- ENV MPLCONFIGDIR=/tmp/matplotlib # --- Install PyTorch (CPU version) --- RUN pip install torch==2.0.1+cpu torchvision==0.15.2+cpu torchaudio==2.0.2+cpu --index-url https://download.pytorch.org/whl/cpu # --- Install basic Python dependencies --- COPY requirements.txt . RUN pip install --upgrade pip RUN pip install -r requirements.txt # --- Install Detectron2 --- RUN pip install 'git+https://github.com/facebookresearch/detectron2.git' # --- Copy app code --- COPY . /app WORKDIR /app # --- Run the Gradio app --- CMD ["python3", "app.py"]