Chasing save issues (#2331)

* already_saved_as attribute for gallery items after hiresfix quickbutton
* different method to select image in gallery after hires quickbutton with insert option to avoid other changes
This commit is contained in:
DenOfEquity
2024-11-16 12:27:20 +00:00
committed by GitHub
parent dbccf77f3c
commit f4a6a08ec2
3 changed files with 11 additions and 4 deletions
+7 -1
View File
@@ -470,6 +470,12 @@ def create_ui():
toprow.prompt.submit(**txt2img_args)
toprow.submit.click(**txt2img_args)
def select_gallery_image(index):
index = int(index)
if getattr(shared.opts, 'hires_button_gallery_insert', False):
index += 1
return gr.update(selected_index=index)
txt2img_upscale_inputs = txt2img_inputs[0:1] + [output_panel.gallery, dummy_component_number, output_panel.generation_info] + txt2img_inputs[1:]
output_panel.button_upscale.click(
fn=wrap_gradio_gpu_call(modules.txt2img.txt2img_upscale, extra_outputs=[None, '', '']),
@@ -477,7 +483,7 @@ def create_ui():
inputs=txt2img_upscale_inputs,
outputs=txt2img_outputs,
show_progress=False,
)
).then(fn=select_gallery_image, js="selected_gallery_index", inputs=[dummy_component], outputs=[output_panel.gallery])
res_switch_btn.click(lambda w, h: (h, w), inputs=[width, height], outputs=[width, height], show_progress=False)