Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| # Set working directory | |
| 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 build for Hugging Face free tier) | |
| RUN pip install torch==2.0.1+cpu torchvision==0.15.2+cpu --index-url https://download.pytorch.org/whl/cpu | |
| # Install Python deps | |
| RUN pip install -r requirements.txt | |
| # Install Detectron2 | |
| RUN pip install 'git+https://github.com/facebookresearch/detectron2.git' | |
| # Clone & install SAM2 | |
| RUN git clone https://github.com/facebookresearch/segment-anything-2.git && \ | |
| pip install -e segment-anything-2 | |
| # Copy your custom config | |
| COPY sam2.1_hiera_l.yaml /app/sam2.1_hiera_l.yaml | |
| # Install gdown to fetch Google Drive models | |
| RUN pip install gdown | |
| # Download SAM2.1 model weight | |
| RUN gdown --id 1b35mcBfjonS7O5k2RF9xZgtAzCwjn-WE -O /app/sam2.1_hiera_large.pt | |
| # Expose FastAPI port | |
| EXPOSE 7860 | |
| # Start FastAPI app | |
| CMD ["uvicorn", "app3:app", "--host", "0.0.0.0", "--port", "7860"] |