Real-ESRGAN Upscaler API

图片超分辨率服务,支持 2x / 4x 放大,CPU 推理。

Endpoints

GET /health

健康检查,确认服务在线。

{
  "status": "ok",
  "supported_scales": [2, 4],
  "note": "CPU inference, 512x512 → x4 takes ~30-60s"
}

POST /upscale

上传图片进行超分辨率放大。

参数(Query):

  • scale:放大倍数,24(默认 4)
  • output_format:输出格式,pngjpeg(默认 png)

Body: multipart/form-data,字段名 image

返回: 图片二进制(png 或 jpeg)

响应 Headers:

  • X-Input-Size:原始尺寸,如 512x512
  • X-Output-Size:放大后尺寸,如 2048x2048
  • X-Elapsed-Seconds:推理耗时

/ui

Gradio 可视化界面,直接浏览器操作。

调用示例

import requests

with open("input.png", "rb") as f:
    resp = requests.post(
        "https://your-space.hf.space/upscale?scale=4&output_format=png",
        files={"image": ("input.png", f, "image/png")},
        timeout=180,
    )

with open("output.png", "wb") as f:
    f.write(resp.content)

print(resp.headers.get("X-Elapsed-Seconds"), "秒")

限制

  • 输入图片最大 1024×1024(约 1MP),超过会报 400
  • CPU 推理,512×512 图约需 30-60 秒
  • 48小时无活动会自动休眠,调用前先 GET /health 唤醒
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support