FROM python:3.10-slim WORKDIR /app # System deps for Detectron2 RUN apt-get update && apt-get install -y \ git git-lfs ffmpeg libsm6 libxext6 libgl1 curl \ build-essential cmake ninja-build \ && rm -rf /var/lib/apt/lists/* \ && git lfs install # PyTorch RUN pip install --no-cache-dir torch==2.0.1 torchvision==0.15.2 # Detectron2 from source RUN pip install --no-cache-dir git+https://github.com/facebookresearch/detectron2.git # Other deps with fixed NumPy version RUN pip install --no-cache-dir \ gradio>=4.0.0 \ opencv-python-headless \ "numpy<2" \ Pillow \ fvcore \ iopath \ pyyaml \ tqdm \ huggingface_hub COPY . /app EXPOSE 7860 CMD ["python", "app.py"]