File size: 2,308 Bytes
5068f92
57ddc9e
9a0e528
43b3059
9a0e528
 
c34e2a8
c27f5f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f82f269
512f81b
 
 
 
 
 
 
 
 
 
f82f269
3ea28e9
9a0e528
52b8d36
9a0e528
 
 
 
 
 
 
 
 
 
dabec21
9a0e528
 
c34e2a8
c27f5f3
 
 
 
9a0e528
 
c27f5f3
9a0e528
 
 
c27f5f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d62e849
dabec21
c27f5f3
512f81b
c27f5f3
2630fab
57ddc9e
9a0e528
 
 
f511784
9a0e528
 
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
83
84
85
86
87
88
89
90
91
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-devel

ENV DEBIAN_FRONTEND=noninteractive

# Set the MKL_THREADING_LAYER environment variable to GNU
ENV MKL_THREADING_LAYER=GNU

# Install system dependencies including those required for dlib
RUN apt-get update && apt-get install -y \
    git \
    wget \
    libgl1-mesa-glx \
    libglib2.0-0 \
    ffmpeg \
    libx264-dev \
    build-essential \
    cmake \
    libopenblas-dev \
    liblapack-dev \
    libx11-dev \
    libgtk-3-dev \
    python3-dev

# Clone and build dlib from source
RUN git clone https://github.com/davisking/dlib.git && \
    cd dlib && \
    mkdir build && \
    cd build && \
    cmake .. && \
    cmake --build . && \
    cd .. && \
    python setup.py install

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

# Print detailed Python information
RUN python -c "import sys; print(f'Python {sys.version}')"

# Clone the repository
RUN git clone -b dev https://github.com/fffiloni/dreamtalk $HOME/app 
    
# Download model checkpoints
RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O $HOME/app/checkpoints/denoising_network.pth
RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/renderer.pt -O $HOME/app/checkpoints/renderer.pt
    
# Install Python dependencies
RUN pip install --no-cache-dir \
    urllib3==1.26.6 \
    transformers==4.28.1 \
    yacs==0.1.8 \
    scipy==1.10.1 \
    scikit-image==0.20.0 \
    scikit-learn==1.2.2 \
    PyYAML==6.0 \
    Pillow==9.5.0 \
    numpy==1.24.2 \
    opencv-python==4.7.0.72 \
    imageio==2.27.0 \
    ffmpeg-python \
    av==11.0.0 \
    moviepy==1.0.3

RUN pip install gradio

# Install dlib with verbose output
#RUN pip install --verbose --no-cache-dir dlib-binary

COPY app.py .

# 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"]