Skip to content

Commit 54a56c7

Browse files
committed
fix issues with image saving
1 parent 5673c52 commit 54a56c7

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

modules/call_queue.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,9 @@ def sagemaker_inference(task, infer, username, sagemaker_endpoint, *args, **kwar
310310
for image in processed['images']:
311311
images.append(Image.open(io.BytesIO(base64.b64decode(image))))
312312
parameters = processed['parameters']
313-
info = processed['info']
313+
info = json.loads(processed['info'])
314314

315-
return images, json.dumps(payload), modules.ui.plaintext_to_html(info)
315+
return images, json.dumps(info), modules.ui.plaintext_to_html('\n'.join(info['infotexts']))
316316
else:
317317
extras_mode = args[0]
318318
resize_mode = args[1]
@@ -406,8 +406,8 @@ def sagemaker_inference(task, infer, username, sagemaker_endpoint, *args, **kwar
406406
images = []
407407
for image in processed['images']:
408408
images.append(Image.open(io.BytesIO(base64.b64decode(image))))
409-
info = processed['html_info']
410-
return images, modules.ui.plaintext_to_html(info), ''
409+
info = json.loads(processed['html_info'])
410+
return images, json.dumps(info), modules.ui.plaintext_to_html('\n'.join(info['infotexts']))
411411

412412
def f(username, *args, **kwargs):
413413
if cmd_opts.pureui and func == modules.txt2img.txt2img:

modules/ui.py

+1-11
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ def open_folder(f):
613613
with gr.Column():
614614
with gr.Row():
615615
if tabname != "extras":
616-
save = gr.Button('Save', elem_id=f'save_{tabname}', visible=False)
616+
save = gr.Button('Save', elem_id=f'save_{tabname}')
617617

618618
buttons = parameters_copypaste.create_buttons(["img2img", "inpaint", "extras"])
619619
button_id = "hidden_element" if shared.cmd_opts.hide_ui_dir_config else 'open_folder'
@@ -667,16 +667,10 @@ def open_folder(f):
667667
parameters_copypaste.bind_buttons(buttons, result_gallery, "txt2img" if tabname == "txt2img" else None)
668668
return result_gallery, generation_info if tabname != "extras" else html_info_x, html_info
669669

670-
txt2img_submit = None
671-
img2img_submit = None
672-
extras_submit = None
673-
674670
def update_sagemaker_endpoint():
675-
print('---sagemaker_endpoint---', shared.opts.sagemaker_endpoint)
676671
return gr.update(value=shared.opts.sagemaker_endpoint, choices=shared.sagemaker_endpoints)
677672

678673
def update_sd_model_checkpoint():
679-
print('---sd_model_checkpoint---', shared.opts.sd_model_checkpoint)
680674
return gr.update(value=shared.opts.sd_model_checkpoint, choices=modules.sd_models.checkpoint_tiles())
681675

682676
def update_username():
@@ -953,7 +947,6 @@ def request_restart():
953947
with gr.Blocks(analytics_enabled=False) as txt2img_interface:
954948
txt2img_prompt, roll, txt2img_prompt_style, txt2img_negative_prompt, txt2img_prompt_style2, submit, _, _, txt2img_prompt_style_apply, txt2img_save_style, txt2img_paste, token_counter, token_button = create_toprow(is_img2img=False)
955949
txt_prompt_img = gr.File(label="", elem_id="txt2img_prompt_image", file_count="single", type="bytes", visible=False)
956-
txt2img_submit = submit
957950

958951
with gr.Row(elem_id='txt2img_progress_row'):
959952
with gr.Column(scale=1):
@@ -1106,7 +1099,6 @@ def request_restart():
11061099

11071100
with gr.Blocks(analytics_enabled=False) as img2img_interface:
11081101
img2img_prompt, roll, img2img_prompt_style, img2img_negative_prompt, img2img_prompt_style2, submit, img2img_interrogate, img2img_deepbooru, img2img_prompt_style_apply, img2img_save_style, img2img_paste, token_counter, token_button = create_toprow(is_img2img=True)
1109-
img2img_submit = submit
11101102

11111103
with gr.Row(elem_id='img2img_progress_row'):
11121104
img2img_prompt_img = gr.File(label="", elem_id="img2img_prompt_image", file_count="single", type="bytes", visible=False)
@@ -1371,7 +1363,6 @@ def update_orig(image, state):
13711363
show_extras_results = gr.Checkbox(label='Show result images', value=True)
13721364

13731365
submit = gr.Button('Generate', elem_id="extras_generate", variant='primary')
1374-
extras_submit = submit
13751366

13761367
with gr.Tabs(elem_id="extras_resize_mode"):
13771368
with gr.TabItem('Scale by'):
@@ -2035,7 +2026,6 @@ def save_userdata(user_dataframe, request: gr.Request):
20352026
'items': items
20362027
}
20372028
response = requests.post(url=f'{shared.api_endpoint}/sd/user', json=inputs)
2038-
print(response.text)
20392029
if response.status_code == 200:
20402030
print(response.text)
20412031
return user_dataframe

0 commit comments

Comments
 (0)