Spaces:
Sleeping
Sleeping
File size: 1,184 Bytes
92de0f9 8d0b841 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 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"] |