mirror of
https://github.com/ahgsql/StyleSelectorXL.git
synced 2026-11-05 00:37:24 +00:00
[GH-ISSUE #30] 出现: expected string or bytes-like object #19
Labels
No labels
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ahgsql/StyleSelectorXL#19
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @liangcaihua on GitHub (Nov 5, 2023).
Original GitHub issue: https://github.com/ahgsql/StyleSelectorXL/issues/30
在使用api的过程中,会导致sd-webui程序出现如上错误
StyleSelectorXL.py 修改如下:
附api程序:
import json
import requests
import io
import base64
from PIL import Image
url = 'http://127.0.0.1:7860/sdapi/v1/txt2img'
payload = {
'prompt': 'chariot,white_background,science_fiction,wide_shot',
'negative_prompt': '',
'styles': [
'增强'
],
'seed': -1,
'batch_size': 1,
'n_iter': 4,
'steps': 26,
'cfg_scale': 7,
'width': 1024,
'height': 1024,
'do_not_save_samples': 'true',
'do_not_save_grid': 'true',
'eta': 0,
'denoising_strength': 0,
'comments': {},
'send_images': 'true',
'save_images': 'true',
}
print(url)
response = requests.post(url=url, json=payload)
r = response.json()
image = Image.open(io.BytesIO(base64.b64decode(r['images'][0])))
image