File size: 2,223 Bytes
3b79b75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ca77f10
3b79b75
 
 
 
 
cb26105
3b79b75
 
 
 
 
 
9615660
 
 
 
 
 
ca77f10
 
3b79b75
 
 
 
 
 
 
 
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
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y git libgl1-mesa-glx libglib2.0-0

RUN apt-get update && apt-get install -y unzip build-essential aria2

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 working directory to the user's home directory
WORKDIR $HOME/app


# Clone your repository or add your code to the container
RUN git clone https://github.com/sczhou/ProPainter.git $HOME/app

# Install specific versions of PyTorch and TorchVision
RUN pip install torch==2.0.1+cu117 torchvision==0.15.2+cu117 -f https://download.pytorch.org/whl/torch_stable.html

# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt gradio==3.48.0 opencv-python moviepy gradio_client

RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/ProPainter/resolve/main/i3d_rgb_imagenet.pt -d $HOME/app/weigths -o i3d_rgb_imagenet.pt 
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/ProPainter/resolve/main/raft-things.pth -d $HOME/app/weights -o raft-things.pth
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/ProPainter/resolve/main/recurrent_flow_completion.pth -d $HOME/app/weights -o recurrent_flow_completion.pth
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/ProPainter/resolve/main/ProPainter.pth -d $HOME/app/weights -o ProPainter.pth

# Create a directory in the container using the environment variable
RUN mkdir -p $HOME/app/hf-examples

# Copy the entire "hf-examples" folder and its contents from the same directory as the Dockerfile to the container directory
COPY hf-examples $HOME/app/hf-examples/

COPY app.py .

RUN find $HOME/app

# Set the environment variable to specify the GPU device
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
ENV CUDA_VISIBLE_DEVICES=0

# Run your app.py script
CMD ["python", "app.py"]