Skip to content

ashleykleynhans/runpod-worker-real-esrgan

Repository files navigation

Real-ESRGAN | RunPod Serverless Worker

The is the source code for a RunPod Serverless worker that uses Real-ESRGAN for Restoration/Upscaling.

Model

The following models are available by default:

  • RealESRGAN_x2plus
  • RealESRGAN_x4plus
  • RealESRNet_x4plus
  • RealESRGAN_x4plus_anime_6B

Testing

  1. Local Testing
  2. RunPod Testing

Building the Docker image that will be used by the Serverless Worker

  1. Building the Image

API

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
  }
}

Serverless Handler

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"
  }
}

Acknowledgements

Community and Contributing

Pull requests and issues on GitHub are welcome. Bug fixes and new features are encouraged.

Appreciate my work?

Buy Me A Coffee

About

RunPod Serverless Worker for Real-ESRGAN Restoration and Upscaling

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages