Skip to content

Commit 32c0eab

Browse files
committed
load all settings in one call instead of one by one when the page loads
1 parent 5302e2c commit 32c0eab

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

modules/ui.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ def create_ui(wrap_gradio_gpu_call):
11411141
outputs=[html, generation_info, html2],
11421142
)
11431143

1144-
with gr.Blocks() as modelmerger_interface:
1144+
with gr.Blocks(analytics_enabled=False) as modelmerger_interface:
11451145
with gr.Row().style(equal_height=False):
11461146
with gr.Column(variant='panel'):
11471147
gr.HTML(value="<p>A merger of the two checkpoints will be generated in your <b>checkpoint</b> directory.</p>")
@@ -1161,7 +1161,7 @@ def create_ui(wrap_gradio_gpu_call):
11611161

11621162
sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings()
11631163

1164-
with gr.Blocks() as train_interface:
1164+
with gr.Blocks(analytics_enabled=False) as train_interface:
11651165
with gr.Row().style(equal_height=False):
11661166
gr.HTML(value="<p style='margin-bottom: 0.7em'>See <b><a href=\"https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Textual-Inversion\">wiki</a></b> for detailed explanation.</p>")
11671167

@@ -1420,15 +1420,14 @@ def fun():
14201420

14211421
if info.refresh is not None:
14221422
if is_quicksettings:
1423-
res = comp(label=info.label, value=fun, elem_id=elem_id, **(args or {}))
1423+
res = comp(label=info.label, value=fun(), elem_id=elem_id, **(args or {}))
14241424
create_refresh_button(res, info.refresh, info.component_args, "refresh_" + key)
14251425
else:
14261426
with gr.Row(variant="compact"):
1427-
res = comp(label=info.label, value=fun, elem_id=elem_id, **(args or {}))
1427+
res = comp(label=info.label, value=fun(), elem_id=elem_id, **(args or {}))
14281428
create_refresh_button(res, info.refresh, info.component_args, "refresh_" + key)
14291429
else:
1430-
res = comp(label=info.label, value=fun, elem_id=elem_id, **(args or {}))
1431-
1430+
res = comp(label=info.label, value=fun(), elem_id=elem_id, **(args or {}))
14321431

14331432
return res
14341433

@@ -1639,6 +1638,17 @@ def request_restart():
16391638
outputs=[component, text_settings],
16401639
)
16411640

1641+
component_keys = [k for k in opts.data_labels.keys() if k in component_dict]
1642+
1643+
def get_settings_values():
1644+
return [getattr(opts, key) for key in component_keys]
1645+
1646+
demo.load(
1647+
fn=get_settings_values,
1648+
inputs=[],
1649+
outputs=[component_dict[k] for k in component_keys],
1650+
)
1651+
16421652
def modelmerger(*args):
16431653
try:
16441654
results = modules.extras.run_modelmerger(*args)

0 commit comments

Comments
 (0)