|
|
|
|
@ -1175,10 +1175,13 @@ Requested path was: {f}
|
|
|
|
|
changed = 0
|
|
|
|
|
|
|
|
|
|
for key, value, comp in zip(opts.data_labels.keys(), args, components):
|
|
|
|
|
if not opts.same_type(value, opts.data_labels[key].default):
|
|
|
|
|
return f"Bad value for setting {key}: {value}; expecting {type(opts.data_labels[key].default).__name__}"
|
|
|
|
|
if comp != dummy_component and not opts.same_type(value, opts.data_labels[key].default):
|
|
|
|
|
return f"Bad value for setting {key}: {value}; expecting {type(opts.data_labels[key].default).__name__}", opts.dumpjson()
|
|
|
|
|
|
|
|
|
|
for key, value, comp in zip(opts.data_labels.keys(), args, components):
|
|
|
|
|
if comp == dummy_component:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
comp_args = opts.data_labels[key].component_args
|
|
|
|
|
if comp_args and isinstance(comp_args, dict) and comp_args.get('visible') is False:
|
|
|
|
|
continue
|
|
|
|
|
@ -1196,6 +1199,21 @@ Requested path was: {f}
|
|
|
|
|
|
|
|
|
|
return f'{changed} settings changed.', opts.dumpjson()
|
|
|
|
|
|
|
|
|
|
def run_settings_single(value, key):
|
|
|
|
|
if not opts.same_type(value, opts.data_labels[key].default):
|
|
|
|
|
return gr.update(visible=True), opts.dumpjson()
|
|
|
|
|
|
|
|
|
|
oldval = opts.data.get(key, None)
|
|
|
|
|
opts.data[key] = value
|
|
|
|
|
|
|
|
|
|
if oldval != value:
|
|
|
|
|
if opts.data_labels[key].onchange is not None:
|
|
|
|
|
opts.data_labels[key].onchange()
|
|
|
|
|
|
|
|
|
|
opts.save(shared.config_filename)
|
|
|
|
|
|
|
|
|
|
return gr.update(value=value), opts.dumpjson()
|
|
|
|
|
|
|
|
|
|
with gr.Blocks(analytics_enabled=False) as settings_interface:
|
|
|
|
|
settings_submit = gr.Button(value="Apply settings", variant='primary')
|
|
|
|
|
result = gr.HTML()
|
|
|
|
|
@ -1203,6 +1221,8 @@ Requested path was: {f}
|
|
|
|
|
settings_cols = 3
|
|
|
|
|
items_per_col = int(len(opts.data_labels) * 0.9 / settings_cols)
|
|
|
|
|
|
|
|
|
|
quicksettings_list = []
|
|
|
|
|
|
|
|
|
|
cols_displayed = 0
|
|
|
|
|
items_displayed = 0
|
|
|
|
|
previous_section = None
|
|
|
|
|
@ -1225,10 +1245,14 @@ Requested path was: {f}
|
|
|
|
|
|
|
|
|
|
gr.HTML(elem_id="settings_header_text_{}".format(item.section[0]), value='<h1 class="gr-button-lg">{}</h1>'.format(item.section[1]))
|
|
|
|
|
|
|
|
|
|
component = create_setting_component(k)
|
|
|
|
|
component_dict[k] = component
|
|
|
|
|
components.append(component)
|
|
|
|
|
items_displayed += 1
|
|
|
|
|
if item.show_on_main_page:
|
|
|
|
|
quicksettings_list.append((i, k, item))
|
|
|
|
|
components.append(dummy_component)
|
|
|
|
|
else:
|
|
|
|
|
component = create_setting_component(k)
|
|
|
|
|
component_dict[k] = component
|
|
|
|
|
components.append(component)
|
|
|
|
|
items_displayed += 1
|
|
|
|
|
|
|
|
|
|
request_notifications = gr.Button(value='Request browser notifications', elem_id="request_notifications")
|
|
|
|
|
request_notifications.click(
|
|
|
|
|
@ -1242,7 +1266,6 @@ Requested path was: {f}
|
|
|
|
|
reload_script_bodies = gr.Button(value='Reload custom script bodies (No ui updates, No restart)', variant='secondary')
|
|
|
|
|
restart_gradio = gr.Button(value='Restart Gradio and Refresh components (Custom Scripts, ui.py, js and css only)', variant='primary')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def reload_scripts():
|
|
|
|
|
modules.scripts.reload_script_body_only()
|
|
|
|
|
|
|
|
|
|
@ -1289,7 +1312,11 @@ Requested path was: {f}
|
|
|
|
|
css += css_hide_progressbar
|
|
|
|
|
|
|
|
|
|
with gr.Blocks(css=css, analytics_enabled=False, title="Stable Diffusion") as demo:
|
|
|
|
|
|
|
|
|
|
with gr.Row(elem_id="quicksettings"):
|
|
|
|
|
for i, k, item in quicksettings_list:
|
|
|
|
|
component = create_setting_component(k)
|
|
|
|
|
component_dict[k] = component
|
|
|
|
|
|
|
|
|
|
settings_interface.gradio_ref = demo
|
|
|
|
|
|
|
|
|
|
with gr.Tabs() as tabs:
|
|
|
|
|
@ -1306,7 +1333,16 @@ Requested path was: {f}
|
|
|
|
|
inputs=components,
|
|
|
|
|
outputs=[result, text_settings],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i, k, item in quicksettings_list:
|
|
|
|
|
component = component_dict[k]
|
|
|
|
|
|
|
|
|
|
component.change(
|
|
|
|
|
fn=lambda value, k=k: run_settings_single(value, key=k),
|
|
|
|
|
inputs=[component],
|
|
|
|
|
outputs=[component, text_settings],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def modelmerger(*args):
|
|
|
|
|
try:
|
|
|
|
|
results = modules.extras.run_modelmerger(*args)
|
|
|
|
|
|