darkvibe314 commited on
Commit
2d1c2ea
·
verified ·
1 Parent(s): 08b30a0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -6
Dockerfile CHANGED
@@ -1,8 +1,8 @@
1
- FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
 
5
- # Fix: Use libgl1 instead of libgl1-mesa-glx for newer Debian
6
  RUN apt-get update && apt-get install -y \
7
  libgl1 \
8
  libglib2.0-0 \
@@ -10,13 +10,16 @@ RUN apt-get update && apt-get install -y \
10
  git \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Install heavy dependencies separately to use cache
14
- RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
15
- RUN pip install --no-cache-dir fastapi uvicorn python-multipart Pillow numpy opencv-python-headless
16
 
17
- # Install Real-ESRGAN and its dependencies
 
18
  RUN pip install --no-cache-dir basicsr realesrgan
19
 
 
 
 
20
  COPY . .
21
 
22
  EXPOSE 7860
 
1
+ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  libgl1 \
8
  libglib2.0-0 \
 
10
  git \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Install Torch and Torchvision versions that are compatible with basicsr
14
+ RUN pip install --no-cache-dir torch==1.13.1 torchvision==0.14.1 --index-url https://download.pytorch.org/whl/cpu
 
15
 
16
+ # Install other requirements
17
+ RUN pip install --no-cache-dir fastapi uvicorn python-multipart Pillow numpy opencv-python-headless
18
  RUN pip install --no-cache-dir basicsr realesrgan
19
 
20
+ # 🔥 THE FIX: This command fixes the "functional_tensor" error inside the basicsr library
21
+ RUN sed -i "s/from torchvision.transforms.functional_tensor import rgb_to_grayscale/from torchvision.transforms.functional import rgb_to_grayscale/" /usr/local/lib/python3.9/site-packages/basicsr/data/degradations.py
22
+
23
  COPY . .
24
 
25
  EXPOSE 7860