The is the source code for a RunPod Serverless worker that uses Real-ESRGAN for Restoration/Upscaling.
The following models are available by default:
- RealESRGAN_x2plus
- RealESRGAN_x4plus
- RealESRNet_x4plus
- RealESRGAN_x4plus_anime_6B
The worker provides an API for inference. The API payload looks like this:
{
"input": {
"source_image": "base64 encoded source image content",
"model": "RealESRGAN_x4plus",
"scale": 2,
"face_enhance": true
}
}The serverless handler (handler.py) is a Python script that handles
inference requests. It defines a function handler(event) that takes an
inference request, runs the inference using the Real-ESRGAN model, and
returns the output as a JSON response in the following format:
{
"output": {
"status": "ok",
"image": "base64 encoded output image"
}
}Pull requests and issues on GitHub are welcome. Bug fixes and new features are encouraged.