manyone commited on
Commit
954630c
·
verified ·
1 Parent(s): 7396f95

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -7
Dockerfile CHANGED
@@ -4,25 +4,29 @@ FROM python:3.10
4
  # Set the working directory
5
  WORKDIR /app
6
 
7
- # Install git and ffmpeg (Required for SadTalker video generation)
8
  RUN apt-get update && apt-get install -y git ffmpeg
9
 
10
- # Copy your files into the container
11
  COPY . .
12
 
13
  # Upgrade pip
14
  RUN pip install --no-cache-dir --upgrade pip setuptools wheel
15
 
16
- # Install your requirements
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
- # --- THE FIX IS HERE ---
20
- # This command finds the broken file in the library and edits the code to fix the import error automatically.
 
21
  RUN sed -i 's/from torchvision.transforms.functional_tensor import rgb_to_grayscale/from torchvision.transforms.functional import rgb_to_grayscale/g' /usr/local/lib/python3.10/site-packages/basicsr/data/degradations.py
22
 
23
- # --- NEW LINE HERE ---
24
- # Downgrade Gradio to the version this code was actually written for
25
  RUN pip install "gradio==3.48.0"
26
 
 
 
 
 
27
  # Start the application
28
  CMD ["python", "app.py"]
 
4
  # Set the working directory
5
  WORKDIR /app
6
 
7
+ # Install git and ffmpeg
8
  RUN apt-get update && apt-get install -y git ffmpeg
9
 
10
+ # Copy your files
11
  COPY . .
12
 
13
  # Upgrade pip
14
  RUN pip install --no-cache-dir --upgrade pip setuptools wheel
15
 
16
+ # Install requirements
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
+ # --- PATCHES ---
20
+
21
+ # 1. Fix the torchvision/basicsr error
22
  RUN sed -i 's/from torchvision.transforms.functional_tensor import rgb_to_grayscale/from torchvision.transforms.functional import rgb_to_grayscale/g' /usr/local/lib/python3.10/site-packages/basicsr/data/degradations.py
23
 
24
+ # 2. Downgrade Gradio to 3.x
 
25
  RUN pip install "gradio==3.48.0"
26
 
27
+ # 3. THE NEW FIX: Force the app to listen on 0.0.0.0 instead of 127.0.0.1
28
+ # This finds "demo.launch(" and replaces it with "demo.launch(server_name='0.0.0.0', server_port=7860,"
29
+ RUN sed -i "s/demo.launch(/demo.launch(server_name='0.0.0.0', server_port=7860, /g" app.py
30
+
31
  # Start the application
32
  CMD ["python", "app.py"]