Spaces:
Running
on
A100
Running
on
A100
File size: 2,257 Bytes
0faf301 c71a436 d2be6c5 6e9a86d d2be6c5 6e9a86d d2be6c5 0cdac26 aa10c6b 0faf301 d2be6c5 b1f8888 cb886e8 6e9a86d b1f8888 d2be6c5 06e59b9 d2be6c5 6e9a86d |
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
FROM pytorch/pytorch:2.1.2-cuda11.8-cudnn8-devel
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
build-essential \
python3.9 \
python3-pip \
python3-venv \
libssl-dev \
libffi-dev \
git \
wget \
ca-certificates \
libgl1-mesa-glx \
libglib2.0-0 \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
# Create a symlink for python
RUN ln -s /usr/bin/python3 /usr/bin/python
# Create a non-root user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONPATH=$HOME/app \
PYTHONUNBUFFERED=1 \
GRADIO_ALLOW_FLAGGING=never \
GRADIO_NUM_PORTS=1 \
GRADIO_SERVER_NAME=0.0.0.0 \
GRADIO_THEME=huggingface \
GRADIO_SHARE=False \
SYSTEM=spaces
# Set the environment variable to specify the GPU device
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
ENV CUDA_VISIBLE_DEVICES=0
# Clone the RB-Modulation repository
RUN git clone https://github.com/google/RB-Modulation.git $HOME/app
# Set the working directory
WORKDIR $HOME/app
RUN python3 -m pip install --upgrade pip
# Download pretrained models
RUN cd third_party/StableCascade/models && \
bash download_models.sh essential big-big bfloat16 && \
cd ../../..
# Install StableCascade requirements
RUN cd third_party/StableCascade && \
pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir jupyter notebook opencv-python matplotlib ftfy && \
cd ../..
# Install gdown for Google Drive downloads
RUN pip install --no-cache-dir gdown
# Download pre-trained CSD weights
RUN gdown https://drive.google.com/uc?id=1FX0xs8p-C7Ob-h5Y4cUhTeOepHzXv_46 -O third_party/CSD/checkpoint.pth
# Install LangSAM and its dependencies
RUN pip install --no-cache-dir git+https://github.com/IDEA-Research/GroundingDINO.git && \
pip install --no-cache-dir segment-anything==1.0 && \
git clone https://github.com/luca-medeiros/lang-segment-anything && \
cd lang-segment-anything && \
pip install -e . && \
cd ..
# Upgrade pip and install Gradio
RUN python3 -m pip install --no-cache-dir gradio
# Copy the app.py file from the host to the container
COPY --chown=user:user app.py .
# Command to run the Gradio app
CMD ["python3", "app.py"] |