Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复图生图init_images字段为空的bug, 过滤图生图提示词中的额外字符 #870

Merged
merged 1 commit into from
May 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions drawing/sdwebui.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ async def text_to_img(self, prompt):
return [Image(base64=i) for i in r.get('images', [])]

async def img_to_img(self, init_images: List[Image], prompt=''):
# 需要调用get_bytes方法,才能获取到base64字段内容
for x in init_images: await x.get_bytes()
# 消息链显示字符串中有“[图片]”字样,需要过滤
prompt = prompt.replace("[图片]", "")
payload = {
'init_images': [x.base64 for x in init_images],
'enable_hr': 'false',
Expand Down