Replies: 2 comments
-
See import requests
import base64
url = "http://127.0.0.1:7860"
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,
"alwayson_scripts": {
"soft inpainting": {
"args": [
{
"Soft inpainting": True,
"Schedule bias": 1,
"Preservation strength": 0.5,
"Transition contrast boost": 4,
"Mask influence": 0,
"Difference threshold": 0.5,
"Difference contrast": 2,
},
]
}
}
}
response = requests.post(url=f'{url}/sdapi/v1/img2img', json=payload)
r = response.json()
with open("output.png", 'wb') as f:
f.write(base64.b64decode(r['images'][0])) You can also generate payloads using https://github.com/huchenlei/sd-webui-api-payload-display |
Beta Was this translation helpful? Give feedback.
0 replies
-
I can't disable it in the API. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
There is a "Soft inpainting" tab with 6 parameters in webui interface but I can't figure out how to use it with API. I've read all documentation and still can't find anything about these parameters. I don't understand how is it possible as "soft inpainting" tab covers half the screen of webui interface, I don't believe that I can't use these parameters with API
Beta Was this translation helpful? Give feedback.
All reactions