Spaces:
Sleeping
Sleeping
File size: 1,219 Bytes
2751713 e9f1b56 2751713 e9f1b56 2751713 e9f1b56 2751713 e9f1b56 1026b6d e9f1b56 6f575dc bba0ec4 e9f1b56 | 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 | FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
wget \
curl \
libsm6 \
libxext6 \
libxrender-dev \
libgl1-mesa-glx \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies first
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Clone Segment Anything 2 from Meta
RUN git clone https://github.com/facebookresearch/sam2.git segment-anything-2 && \
cd segment-anything-2 && \
pip install -e . && \
cd ..
# Download SAM2 model weights
RUN cd segment-anything-2/checkpoints && \
bash download_ckpts.sh && \
cd ../..
# Set Hugging Face token for VREyeSAM weights (injected by HF Spaces)
ENV HF_TOKEN=""
# Copy application files
COPY app.py model_server.py ./
# Create .streamlit directory and config
RUN mkdir -p .streamlit
COPY .streamlit/config.toml .streamlit/
# Note: VREyeSAM fine-tuned weights will be downloaded at runtime by model_server.py
# using the HF_TOKEN from HF Spaces Secrets
# Expose Streamlit port
EXPOSE 7860
# Run Streamlit app
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|