Spaces:
Build error
Build error
| # Use slim Python base image | |
| FROM python:3.10-slim | |
| WORKDIR /app | |
| COPY . . | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| ffmpeg \ | |
| libsm6 \ | |
| libxext6 \ | |
| g++ \ | |
| build-essential \ | |
| cmake \ | |
| python3-dev \ | |
| wget \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Upgrade pip | |
| RUN pip install --upgrade pip | |
| # 🧠 Install PyTorch CPU version first | |
| 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 | |
| # Force refresh of pip environment (fixes torch visibility) | |
| RUN python -c "import torch; print('Torch imported OK')" | |
| # 🧩 Install other dependencies | |
| RUN pip install -r requirements.txt | |
| # 🧱 Clone and install Detectron2 | |
| RUN git clone https://github.com/facebookresearch/detectron2.git /app/detectron2 | |
| RUN pip install --no-cache-dir -e /app/detectron2 | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |