Skip to content
Discussion options

You must be logged in to vote

Have you tried batch mode?

Otherwise, see /sdapi/v1/extra-single-image and /sdapi/v1/extra-batch-images in the API docs.

extra-single-image example:

import requests
import base64

url = "http://127.0.0.1:7860"

with open("input.png", "rb") as f:
    img = base64.b64encode(f.read()).decode('utf-8')

payload = {
    "resize_mode": 0,
    "upscaling_resize": 2,
    "upscaler_1": "ESRGAN_4x",
    "image": img
}

response = requests.post(url=f'{url}/sdapi/v1/extra-single-image', json=payload)
r = response.json()

with open("output.png", 'wb') as f:
    f.write(base64.b64decode(r['image']))

extra-batch-images example:

import requests
import base64
import glob

url = "http://127.0.0.1:7860"

i…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@DjWarmonger
Comment options

Answer selected by DjWarmonger
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants