| --- |
| title: 4K Upscaler Pro |
| emoji: ⬆️ |
| colorFrom: purple |
| colorTo: blue |
| sdk: gradio |
| sdk_version: "5.15.0" |
| python_version: "3.10.13" |
| app_file: app.py |
| pinned: false |
| license: mit |
| --- |
| |
| # ⬆ 4K Upscaler Pro |
|
|
| AI-powered image & video upscaler supporting up to 4K resolution (3840×2160). |
|
|
| ## Features |
| - 🖼 Image upscaling (PNG, JPG, WEBP) |
| - 🎬 Video upscaling (MP4, AVI, MOV) |
| - 🤖 Real-ESRGAN AI upscaling (GPU mode) + Lanczos fallback (CPU) |
| - 📡 Full REST API for n8n, Zapier, or any automation tool |
| - 🎯 Targets: 4K, 2K, 1080p, or 2× original |
|
|
| ## Deployment Guide |
|
|
| ### Step 1: Create Hugging Face Space |
| 1. Go to https://huggingface.co/new-space |
| 2. Name it: `4k-upscaler` |
| 3. SDK: **Gradio** |
| 4. Hardware: **CPU Basic** (free) or **T4 GPU** for Real-ESRGAN |
|
|
| ### Step 2: Upload Files |
| Upload all essential files to your Space: |
| - `app.py` |
| - `core.py` |
| - `requirements.txt` |
| - `pyproject.toml` |
| - `packages.txt` (adds ffmpeg for video rendering) |
| ### Step 3: Get Your API URL |
| Your API will be live at: |
| ``` |
| https://<your-username>-4k-upscaler.hf.space/api/predict |
| ``` |
|
|
| --- |
|
|
| ## n8n Integration |
|
|
| ### Image Upscaling via n8n HTTP Request Node |
|
|
| ``` |
| Method: POST |
| URL: https://<your-username>-4k-upscaler.hf.space/api/predict |
| Headers: |
| Content-Type: application/json |
| Authorization: Bearer <YOUR_HF_TOKEN> (only if Space is private) |
| |
| Body (JSON): |
| { |
| "data": [ |
| "data:image/png;base64,<BASE64_IMAGE>", |
| "Lanczos (Fast)", |
| "4K (3840×2160)" |
| ] |
| } |
| ``` |
|
|
| ### n8n Workflow Steps |
| 1. **Trigger** (e.g., HTTP webhook or file watch) |
| 2. **Read Binary Data** → convert image to base64 |
| 3. **HTTP Request** → POST to HF Space API |
| 4. **Extract Result** → `{{ $json.data[0] }}` = base64 upscaled image |
| 5. **Write File** → save the upscaled image |
|
|
| ### Video Upscaling (fn_index: 1) |
| ```json |
| { |
| "fn_index": 1, |
| "data": [ |
| "<video_url_or_base64>", |
| "Lanczos (Fast)", |
| "4K (3840×2160)" |
| ] |
| } |
| ``` |
| |
| --- |
|
|
| ## API Reference |
|
|
| | Parameter | Values | |
| |-----------|--------| |
| | Method | `Real-ESRGAN (AI)` or `Lanczos (Fast)` | |
| | Target | `4K (3840×2160)`, `2K (2560×1440)`, `1080p (1920×1080)`, `2x Original` | |
|
|
| ## Hardware Recommendation |
| - **CPU (Free):** Lanczos fast upscaling works perfectly |
| - **T4 GPU ($0.60/hr):** Enables Real-ESRGAN AI upscaling for dramatically better quality |
|
|