This is a Truss for serving an implementation of TencentARC GFPGAN. GFPGAN is an algorithm for real-world face restoration. It can be used on old photos of faces to remove blur, and increase clarity and resolution.
It leverages rich and diverse priors encapsulated in a pretrained face GAN (e.g., StyleGAN2) for "blind face" restoration.
First, clone this repository:
git clone https://github.com/basetenlabs/truss-examples/
cd gfp-gan-truss
Before deployment:
- Make sure you have a Baseten account and API key.
- Install the latest version of Truss:
pip install --upgrade truss
With gfp-gan-truss
as your working directory, you can deploy the model with:
truss push
Paste your Baseten API key if prompted.
For more information, see Truss documentation.
The input should be a dictionary with the following key:
image
- the image to be restored, encoded as base64.
The model returns a dictionary containing the base64-encoded restored image:
status
- eithersuccess
orfailed
data
- the restored image, encoded as base64message
- will contain details in the case of errors
truss predict -d '{"image": "{BASE_64_INPUT}"}'
You can also invoke this model on Baseten with the following cURL command (just fill in the model version ID and API Key):
$ curl -X POST https://app.baseten.co/models/{MODEL_VERSION_ID}/predict \
-H 'Authorization: Api-Key {YOUR_API_KEY}' \
-d '{"image": "{BASE_64_INPUT}"}'