API cannot find the upscaler (what is the path it's looking for it in?) #15383
-
Beta Was this translation helpful? Give feedback.
Answered by
missionfloyd
Mar 27, 2024
Replies: 2 comments 2 replies
-
It uses the models on the server (the ones on the Extras tab). Use the name, not the filename. See 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'])) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Faishun
-
Hello, I have a bit of the same type of error. I think I'm using the API wrong. I have the impression that the API has changed recently. We should no longer use "/sdapi/v1/...." after our url. But rather something like /api/{api_name}. I don't really understand how this works. Anyone to help me? THANKS |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It uses the models on the server (the ones on the Extras tab). Use the name, not the filename. See
/sdapi/v1/upscalers
.