From 986ab451cf721ad301e5b91518ddb84c4af05788 Mon Sep 17 00:00:00 2001 From: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> Date: Thu, 28 Dec 2023 16:46:19 +0100 Subject: [PATCH 01/12] add workaround for changing prompt while generating (#1578) --- webui.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webui.py b/webui.py index a5138abf..289e365c 100644 --- a/webui.py +++ b/webui.py @@ -525,7 +525,7 @@ with shared.gradio_root: loaded_json = None if loaded_json is None: - return gr.update(), gr.update(visible=True), gr.update(visible=False) + return gr.update(), gr.update(), gr.update(visible=False) return json.dumps(loaded_json), gr.update(visible=False), gr.update(visible=True) @@ -557,11 +557,11 @@ with shared.gradio_root: load_parameter_button ] + lora_ctrls, queue=False, show_progress=False) - generate_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False), []), outputs=[stop_button, skip_button, generate_button, gallery]) \ + generate_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), []), outputs=[stop_button, skip_button, generate_button, gallery]) \ .then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed) \ .then(advanced_parameters.set_all_advanced_parameters, inputs=adps) \ .then(fn=generate_clicked, inputs=ctrls, outputs=[progress_html, progress_window, progress_gallery, gallery]) \ - .then(lambda: (gr.update(visible=True), gr.update(visible=False), gr.update(visible=False)), outputs=[generate_button, stop_button, skip_button]) \ + .then(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=False), gr.update(visible=False)), outputs=[generate_button, stop_button, skip_button]) \ .then(fn=lambda: None, _js='playNotification').then(fn=lambda: None, _js='refresh_grid_delayed') for notification_file in ['notification.ogg', 'notification.mp3']: From 48b1324a267a36ae9824a18afd5f4ceaf0434b36 Mon Sep 17 00:00:00 2001 From: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> Date: Thu, 28 Dec 2023 16:48:30 +0100 Subject: [PATCH 02/12] add default_max_image_number to config, use as maximum in default_image_number (#1616) --- modules/config.py | 7 ++++++- webui.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/config.py b/modules/config.py index 9cc61788..c7af33db 100644 --- a/modules/config.py +++ b/modules/config.py @@ -243,10 +243,15 @@ default_advanced_checkbox = get_config_item_or_set_default( default_value=False, validator=lambda x: isinstance(x, bool) ) +default_max_image_number = get_config_item_or_set_default( + key='default_max_image_number', + default_value=32, + validator=lambda x: isinstance(x, int) and x >= 1 +) default_image_number = get_config_item_or_set_default( key='default_image_number', default_value=2, - validator=lambda x: isinstance(x, int) and 1 <= x <= 32 + validator=lambda x: isinstance(x, int) and 1 <= x <= default_max_image_number ) checkpoint_downloads = get_config_item_or_set_default( key='checkpoint_downloads', diff --git a/webui.py b/webui.py index 289e365c..ae0be2a6 100644 --- a/webui.py +++ b/webui.py @@ -226,7 +226,7 @@ with shared.gradio_root: aspect_ratios_selection = gr.Radio(label='Aspect Ratios', choices=modules.config.available_aspect_ratios, value=modules.config.default_aspect_ratio, info='width × height', elem_classes='aspect_ratios') - image_number = gr.Slider(label='Image Number', minimum=1, maximum=32, step=1, value=modules.config.default_image_number) + image_number = gr.Slider(label='Image Number', minimum=1, maximum=modules.config.default_max_image_number, step=1, value=modules.config.default_image_number) negative_prompt = gr.Textbox(label='Negative Prompt', show_label=True, placeholder="Type prompt here.", info='Describing what you do not want to see.', lines=2, elem_id='negative_prompt', From ad158450e32ea3d95e6ea0675594aa604ec5a515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=A1=E5=9D=82IO?= <100711412+IOMisaka@users.noreply.github.com> Date: Thu, 28 Dec 2023 23:54:59 +0800 Subject: [PATCH 03/12] fix to_clipboard from non-localhost access (#1576) tested on edge(windows&android) --- modules/private_logger.py | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/modules/private_logger.py b/modules/private_logger.py index 83ba9e36..022d4f8f 100644 --- a/modules/private_logger.py +++ b/modules/private_logger.py @@ -43,14 +43,29 @@ def log(img, dic): "" ) - js = ( - "" +js = ( + """""" ) begin_part = f"Fooocus Log {date_string}{css_styles}{js}

Fooocus Log {date_string} (private)

\n

All images are clean, without any hidden data/meta, and safe to share with others.

\n\n" From 2f6ebbf87699220854d4893d5f217c8760ba6049 Mon Sep 17 00:00:00 2001 From: lllyasviel Date: Thu, 28 Dec 2023 08:04:12 -0800 Subject: [PATCH 04/12] some fix for previous PRs --- fooocus_version.py | 2 +- modules/meta_parser.py | 8 ++++++-- modules/private_logger.py | 2 +- webui.py | 19 +++++++++++++------ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/fooocus_version.py b/fooocus_version.py index 2511cfc7..b8f79381 100644 --- a/fooocus_version.py +++ b/fooocus_version.py @@ -1 +1 @@ -version = '2.1.855' +version = '2.1.856' diff --git a/modules/meta_parser.py b/modules/meta_parser.py index 78d73978..07b42a16 100644 --- a/modules/meta_parser.py +++ b/modules/meta_parser.py @@ -3,7 +3,7 @@ import gradio as gr import modules.config -def load_parameter_button_click(raw_prompt_txt): +def load_parameter_button_click(raw_prompt_txt, is_generating): loaded_parameter_dict = json.loads(raw_prompt_txt) assert isinstance(loaded_parameter_dict, dict) @@ -128,7 +128,11 @@ def load_parameter_button_click(raw_prompt_txt): results.append(gr.update()) results.append(gr.update()) - results.append(gr.update(visible=True)) + if is_generating: + results.append(gr.update()) + else: + results.append(gr.update(visible=True)) + results.append(gr.update(visible=False)) for i in range(1, 6): diff --git a/modules/private_logger.py b/modules/private_logger.py index 022d4f8f..968bd4f5 100644 --- a/modules/private_logger.py +++ b/modules/private_logger.py @@ -43,7 +43,7 @@ def log(img, dic): "" ) -js = ( + js = ( """