Spaces:
Paused
Paused
| FROM python:3.9-slim | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| wget \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 1. Install NumPy 1.x FIRST to prevent 2.0 from being installed | |
| RUN pip install --no-cache-dir "numpy<2.0.0" | |
| # 2. Install Torch (CPU version) | |
| RUN pip install --no-cache-dir torch==1.13.1 torchvision==0.14.1 --index-url https://download.pytorch.org/whl/cpu | |
| # 3. Install other requirements | |
| RUN pip install --no-cache-dir fastapi uvicorn python-multipart Pillow opencv-python-headless | |
| RUN pip install --no-cache-dir basicsr realesrgan | |
| # 4. 🔥 THE PATCHES: | |
| # Fix 1: functional_tensor error | |
| 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 | |
| # Fix 2: Ensure basicsr doesn't crash on startup due to numpy versioning | |
| RUN pip install "numpy<2.0.0" --force-reinstall | |
| COPY . . | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] |