File size: 2,283 Bytes
1bfdf22
d2812b4
 
62bd2b1
 
 
 
b1d0e38
 
 
 
 
66cf549
051eeb7
66cf549
 
b1d0e38
051eeb7
 
 
 
 
b1d0e38
051eeb7
b1d0e38
1bfdf22
 
56cb148
1bfdf22
 
 
 
 
 
 
 
 
 
 
 
 
56cb148
1bfdf22
 
 
73b9ac7
1bfdf22
051eeb7
1bfdf22
8a1db98
1bfdf22
 
 
15b31f2
1bfdf22
 
 
71a1790
15b31f2
7fbd0ef
 
 
fba2a5d
d2812b4
abbc07f
1bfdf22
abbc07f
 
 
be6a684
1bfdf22
d6e9c17
7fbd0ef
7c034bc
abbc07f
1bfdf22
 
 
15b31f2
1bfdf22
 
 
62bd2b1
 
051eeb7
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
# Use the NVIDIA CUDA runtime as a base image
FROM nvidia/cuda:11.3.1-cudnn8-devel-ubuntu20.04
#FROM nvidia/cuda:11.8.0-devel-ubuntu22.04

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive

RUN useradd -m -u 1000 user

USER user

ENV HOME=/home/user \
    CUDA_HOME=/usr/local/cuda \
    PATH=/home/user/.local/bin:$PATH \
    LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} \
    LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_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

# Install system dependencies as root
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    cmake \
    build-essential \
    libgl1-mesa-glx \
    libglib2.0-0 \
    ffmpeg \
    python3.8 \
    python3-pip \
    python3.8-dev \
    && rm -rf /var/lib/apt/lists/*

# Set Python 3.8 as the default python and pip versions
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1

USER user
# Clone the repository (adjust the URL if needed)
RUN git clone --recursive https://github.com/jnjaby/KEEP.git .

# Copy the app.py script into the container
COPY app.py .
COPY requirements_HF.txt .

# Install Python dependencies from requirements.txt
RUN pip install --upgrade pip
RUN pip install -r requirements_HF.txt
RUN pip install gradio

# Install specific Cython version known to work with cupy
RUN pip install 'Cython<3.0'

# Install cupy using the pre-built wheel for CUDA 11.x
RUN pip install cupy

USER root
# Configure git to trust the directory
RUN git config --global --add safe.directory /home/user/app
RUN chown -R user:user /home/user/app

USER user

# Install basicsr with the --user flag
RUN python basicsr/setup.py develop --user

# Install additional Python packages
RUN pip install ffmpeg-python
RUN pip install dlib

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

# Command to run your application
CMD ["python", "app.py"]