API for Soft Inpaiting ? #15138
Answered
by
missionfloyd
psykokwak-com
asked this question in
Q&A
-
Hi all, |
Beta Was this translation helpful? Give feedback.
Answered by
missionfloyd
Mar 6, 2024
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])) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
psykokwak-com
-
I can't disable it, is it always enabled? |
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
See
/sdapi/v1/script-info
for script parameters.