How to use inpaint upload through the API? #13596
-
Hi guys. |
Beta Was this translation helpful? Give feedback.
Answered by
missionfloyd
Oct 11, 2023
Replies: 1 comment 1 reply
-
Send the mask in the import requests
import base64
with open("input.png", "rb") as f, open("mask.png", "rb") as m:
img = base64.b64encode(f.read()).decode('utf-8')
mask = base64.b64encode(m.read()).decode('utf-8')
payload = {
"prompt": "hot air balloon",
"init_images": [img],
"mask": mask,
}
response = requests.post(url='http://127.0.0.1:7860/sdapi/v1/img2img', json=payload)
r = response.json()
with open('output.png', 'wb') as f:
f.write(base64.b64decode(r['images'][0])) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
thefora
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Send the mask in the
mask
parameter. It's a base64-encoded white on black image.