Spaces:
Running
Running
| FROM python:3.9-slim | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| gcc \ | |
| g++ \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender-dev \ | |
| ffmpeg \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set Matplotlib temp folder. This is needed to avoid warnings for missing fonts | |
| ENV MPLCONFIGDIR=/tmp/matplotlib | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements first and install them | |
| COPY requirements.txt . | |
| RUN pip install --upgrade pip | |
| RUN pip install -r requirements.txt | |
| # Install torch separately (before detectron2) | |
| 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 detectron2 separately | |
| RUN pip install 'git+https://github.com/facebookresearch/detectron2.git' | |
| # Copy full app code | |
| COPY . . | |
| # Run | |
| CMD ["python3", "app.py"] |