From 71cfb9ebac7e918995350e98fe6f1a1e73db4022 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sat, 24 Sep 2022 00:13:32 +0300 Subject: [PATCH] fix for settings sometimes not applying on javascript side --- modules/ui.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/modules/ui.py b/modules/ui.py index 1458efa37..09204013a 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -898,7 +898,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): opts.save(shared.config_filename) - return f'{changed} settings changed.' + return f'{changed} settings changed.', opts.dumpjson() with gr.Blocks(analytics_enabled=False) as settings_interface: settings_submit = gr.Button(value="Apply settings", variant='primary') @@ -943,12 +943,6 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): if column is not None: column.__exit__() - settings_submit.click( - fn=run_settings, - inputs=components, - outputs=[result] - ) - interfaces = [ (txt2img_interface, "txt2img", "txt2img"), (img2img_interface, "img2img", "img2img"), @@ -976,11 +970,10 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): interface.render() text_settings = gr.Textbox(elem_id="settings_json", value=lambda: opts.dumpjson(), visible=False) - settings_submit.click( - fn=lambda: opts.dumpjson(), - inputs=[], - outputs=[text_settings], + fn=run_settings, + inputs=components, + outputs=[result, text_settings], ) send_to_img2img.click(