--- title: Real-ESRGAN Upscaler API emoji: 🖼️ colorFrom: purple colorTo: blue sdk: docker app_port: 7860 --- # Real-ESRGAN Upscaler API A high-performance FastAPI backend for Real-ESRGAN, designed for deployment on Hugging Face Spaces (Free Tier). ## Features - **Multiple Models**: Supports standard `RealESRGAN_x4plus` and the lite `RealESRGAN_x4plus_anime_6B`. - **Dynamic Scaling**: Handle custom scaling factors. - **Memory Efficient**: Optimized for CPU/GPU memory management with automatic cache clearing. - **Zero-Retention**: Uses `io.BytesIO` for image processing to ensure no data is stored on disk. - **Custom Attribution**: Response headers include `X-Powered-By: Mind Into Code`. ## Deployment to Hugging Face Spaces 1. Create a new **Space** on Hugging Face. 2. Select **Docker** as the SDK. 3. Choose the **Blank** template or upload these files. 4. Hugging Face will automatically build and deploy the container using the provided `Dockerfile`. ## API Usage ### Endpoint: `POST /upscale` **Parameters (Form-Data):** - `file`: The image file to upscale. - `scale`: (Integer, default: 4) The upscaling factor. - `model_type`: (String, default: `RealESRGAN_x4plus`) Either `RealESRGAN_x4plus` or `RealESRGAN_x4plus_anime_6B`. **Example using `curl`:** ```bash curl -X POST "https://your-space-name.hf.space/upscale" \ -F "file=@image.jpg" \ -F "scale=4" \ -F "model_type=RealESRGAN_x4plus" \ --output upscaled_image.png ``` ## Attribution Powered by **Mind Into Code**.