Upscale images

Our generative upscale increases the quality and details of an image with an AI model. It also upscales a model 4x.

View Generative Upscale in our API reference for more

import requests

def get_base64_from_file(filename):
    with open(filename, "rb") as f:
        return base64.b64encode(f.read()).decode()

url = "https://playground.com/api/models/external/v1/upscale"

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
}

data = {
    "prompt": "a frog",
    "init_image": get_base64_from_file("image.png")
}

response = requests.post(url, headers=headers, json=data)