Spaces:
Paused
Paused
Download Dockerfile from Ribakoo/Image-Enhancer: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/spaces/Ribakoo/Image-Enhancer/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Ribakoo/Image-Enhancer/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Ribakoo/Image-Enhancer/resolve/main/Dockerfile
1.37 kB
| FROM python:3.11-slim | |
| # Prevent python from buffering stdout/stderr | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PORT=7860 | |
| WORKDIR /app | |
| # Install system dependencies (build-essential, git, libgl for image libs) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl \ | |
| ca-certificates \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements and install | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application files | |
| COPY . . | |
| # Ensure models directory has weights (download if missing during build) | |
| RUN python -c " | |
| import urllib.request, os | |
| os.makedirs('models', exist_ok=True) | |
| models = { | |
| 'models/waifu2x_art_scale2x.onnx': 'https://huggingface.co/deepghs/waifu2x_onnx/resolve/main/20230131/onnx_models/cunet/art/scale2x.onnx', | |
| 'models/waifu2x_art_noise1_scale2x.onnx': 'https://huggingface.co/deepghs/waifu2x_onnx/resolve/main/20230131/onnx_models/cunet/art/noise1_scale2x.onnx' | |
| } | |
| for dest, url in models.items(): | |
| if not os.path.exists(dest): | |
| print('Downloading', dest) | |
| urllib.request.urlretrieve(url, dest) | |
| " | |
| # Set non-root permissions for Hugging Face Spaces | |
| RUN useradd -m -u 1000 appuser && \ | |
| chown -R appuser:appuser /app | |
| USER appuser | |
| EXPOSE 7860 | |
| # Launch FastAPI server | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] | |