mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
cleanup gradio
This commit is contained in:
Submodule extensions-builtin/sd-extension-system-info updated: 721658e0e7...2bb95beade
+14
-16
@@ -144,13 +144,11 @@ def interrogate_deepbooru(image):
|
||||
def create_seed_inputs(tab):
|
||||
with gr.Accordion(open=False, label="Seed", elem_id=f"{tab}_seed_group", elem_classes=["small-accordion"]):
|
||||
with FormRow(elem_id=f"{tab}_seed_row", variant="compact"):
|
||||
seed = gr.Number(label='Initial seed', value=-1, elem_id=f"{tab}_seed")
|
||||
seed.style(container=False)
|
||||
seed = gr.Number(label='Initial seed', value=-1, elem_id=f"{tab}_seed", container=False)
|
||||
random_seed = ToolButton(symbols.random, elem_id=f"{tab}_random_seed", label='Random seed')
|
||||
reuse_seed = ToolButton(symbols.reuse, elem_id=f"{tab}_reuse_seed", label='Reuse seed')
|
||||
with FormRow(visible=True, elem_id=f"{tab}_subseed_row"):
|
||||
subseed = gr.Number(label='Variation seed', value=-1, elem_id=f"{tab}_subseed")
|
||||
subseed.style(container=False)
|
||||
subseed = gr.Number(label='Variation seed', value=-1, elem_id=f"{tab}_subseed", container=False)
|
||||
random_subseed = ToolButton(symbols.random, elem_id=f"{tab}_random_subseed")
|
||||
reuse_subseed = ToolButton(symbols.reuse, elem_id=f"{tab}_reuse_subseed")
|
||||
subseed_strength = gr.Slider(label='Variation strength', value=0.0, minimum=0, maximum=1, step=0.01, elem_id=f"{tab}_subseed_strength")
|
||||
@@ -382,7 +380,7 @@ def create_ui(startup_timer = None):
|
||||
extra_networks_ui = ui_extra_networks.create_ui(extra_networks_ui, extra_networks_button, 'txt2img', skip_indexing=opts.extra_network_skip_indexing)
|
||||
timer.startup.record('ui-extra-networks')
|
||||
|
||||
with gr.Row().style(equal_height=False, elem_id="txt2img_interface"):
|
||||
with gr.Row(elem_id="txt2img_interface", equal_height=False):
|
||||
with gr.Column(variant='compact', elem_id="txt2img_settings"):
|
||||
|
||||
with FormRow():
|
||||
@@ -566,7 +564,7 @@ def create_ui(startup_timer = None):
|
||||
from modules import ui_extra_networks
|
||||
extra_networks_ui_img2img = ui_extra_networks.create_ui(extra_networks_ui, extra_networks_button, 'img2img', skip_indexing=opts.extra_network_skip_indexing)
|
||||
|
||||
with FormRow().style(equal_height=False, elem_id="img2img_interface"):
|
||||
with FormRow(elem_id="img2img_interface", equal_height=False):
|
||||
with gr.Column(variant='compact', elem_id="img2img_settings"):
|
||||
copy_image_buttons = []
|
||||
copy_image_destinations = {}
|
||||
@@ -587,19 +585,19 @@ def create_ui(startup_timer = None):
|
||||
with gr.Tabs(elem_id="mode_img2img"):
|
||||
img2img_selected_tab = gr.State(0) # pylint: disable=abstract-class-instantiated
|
||||
with gr.TabItem('Image', id='img2img', elem_id="img2img_img2img_tab") as tab_img2img:
|
||||
init_img = gr.Image(label="Image for img2img", elem_id="img2img_image", show_label=False, source="upload", interactive=True, type="pil", tool="editor", image_mode="RGBA").style(height=480)
|
||||
init_img = gr.Image(label="Image for img2img", elem_id="img2img_image", show_label=False, source="upload", interactive=True, type="pil", tool="editor", image_mode="RGBA", height=480)
|
||||
add_copy_image_controls('img2img', init_img)
|
||||
|
||||
with gr.TabItem('Sketch', id='img2img_sketch', elem_id="img2img_img2img_sketch_tab") as tab_sketch:
|
||||
sketch = gr.Image(label="Image for img2img", elem_id="img2img_sketch", show_label=False, source="upload", interactive=True, type="pil", tool="color-sketch", image_mode="RGBA").style(height=480)
|
||||
sketch = gr.Image(label="Image for img2img", elem_id="img2img_sketch", show_label=False, source="upload", interactive=True, type="pil", tool="color-sketch", image_mode="RGBA", height=480)
|
||||
add_copy_image_controls('sketch', sketch)
|
||||
|
||||
with gr.TabItem('Inpaint', id='inpaint', elem_id="img2img_inpaint_tab") as tab_inpaint:
|
||||
init_img_with_mask = gr.Image(label="Image for inpainting with mask", show_label=False, elem_id="img2maskimg", source="upload", interactive=True, type="pil", tool="sketch", image_mode="RGBA").style(height=480)
|
||||
init_img_with_mask = gr.Image(label="Image for inpainting with mask", show_label=False, elem_id="img2maskimg", source="upload", interactive=True, type="pil", tool="sketch", image_mode="RGBA", height=480)
|
||||
add_copy_image_controls('inpaint', init_img_with_mask)
|
||||
|
||||
with gr.TabItem('Inpaint sketch', id='inpaint_sketch', elem_id="img2img_inpaint_sketch_tab") as tab_inpaint_color:
|
||||
inpaint_color_sketch = gr.Image(label="Color sketch inpainting", show_label=False, elem_id="inpaint_sketch", source="upload", interactive=True, type="pil", tool="color-sketch", image_mode="RGBA").style(height=480)
|
||||
inpaint_color_sketch = gr.Image(label="Color sketch inpainting", show_label=False, elem_id="inpaint_sketch", source="upload", interactive=True, type="pil", tool="color-sketch", image_mode="RGBA", height=480)
|
||||
inpaint_color_sketch_orig = gr.State(None) # pylint: disable=abstract-class-instantiated
|
||||
add_copy_image_controls('inpaint_sketch', inpaint_color_sketch)
|
||||
|
||||
@@ -891,7 +889,7 @@ def create_ui(startup_timer = None):
|
||||
timer.startup.record("ui-extras")
|
||||
|
||||
with gr.Blocks(analytics_enabled=False) as train_interface:
|
||||
ui_train.create_ui(txt2img_preview_params = [txt2img_prompt, txt2img_negative_prompt, steps, sampler_index, cfg_scale, seed, width, height])
|
||||
ui_train.create_ui([txt2img_prompt, txt2img_negative_prompt, steps, sampler_index, cfg_scale, seed, width, height])
|
||||
timer.startup.record("ui-train")
|
||||
|
||||
with gr.Blocks(analytics_enabled=False) as models_interface:
|
||||
@@ -1066,7 +1064,7 @@ def create_ui(startup_timer = None):
|
||||
current_tab.__exit__()
|
||||
|
||||
request_notifications = gr.Button(value='Request browser notifications', elem_id="request_notifications", visible=False)
|
||||
with gr.TabItem("Show all pages", variant='primary', elem_id="settings_show_all_pages"):
|
||||
with gr.TabItem("Show all pages", elem_id="settings_show_all_pages"):
|
||||
create_dirty_indicator("show_all_pages", [], interactive=False)
|
||||
|
||||
with gr.TabItem("User interface", id="system_config", elem_id="tab_config"):
|
||||
@@ -1113,7 +1111,7 @@ def create_ui(startup_timer = None):
|
||||
for _interface, label, _ifid in interfaces:
|
||||
modules.shared.tab_names.append(label)
|
||||
|
||||
with gr.Blocks(theme=modules.shared.gradio_theme, analytics_enabled=False, title="SD.Next", allowed_paths=[cmd_opts.data_dir]) as demo:
|
||||
with gr.Blocks(theme=modules.shared.gradio_theme, analytics_enabled=False, title="SD.Next") as demo:
|
||||
with gr.Row(elem_id="quicksettings", variant="compact"):
|
||||
for _i, k, _item in sorted(quicksettings_list, key=lambda x: quicksettings_names.get(x[1], x[0])):
|
||||
component = create_setting_component(k, is_quicksettings=True)
|
||||
@@ -1146,9 +1144,9 @@ def create_ui(startup_timer = None):
|
||||
inputs=components,
|
||||
outputs=[text_settings, result],
|
||||
)
|
||||
defaults_submit.click(fn=lambda x: modules.shared.restore_defaults(restart=True), _js="restart_reload")
|
||||
restart_submit.click(fn=lambda x: modules.shared.restart_server(restart=True), _js="restart_reload")
|
||||
shutdown_submit.click(fn=lambda x: modules.shared.restart_server(restart=False), _js="restart_reload")
|
||||
defaults_submit.click(fn=lambda: modules.shared.restore_defaults(restart=True), _js="restart_reload")
|
||||
restart_submit.click(fn=lambda: modules.shared.restart_server(restart=True), _js="restart_reload")
|
||||
shutdown_submit.click(fn=lambda: modules.shared.restart_server(restart=False), _js="restart_reload")
|
||||
|
||||
for _i, k, _item in quicksettings_list:
|
||||
component = component_dict[k]
|
||||
|
||||
@@ -395,8 +395,8 @@ def create_ui():
|
||||
import modules.ui
|
||||
with gr.Blocks(analytics_enabled=False) as ui:
|
||||
extensions_disable_all = gr.Radio(label="Disable all extensions", choices=["none", "user", "all"], value=shared.opts.disable_all_extensions, elem_id="extensions_disable_all", visible=False)
|
||||
extensions_disabled_list = gr.Text(elem_id="extensions_disabled_list", visible=False).style(container=False)
|
||||
extensions_update_list = gr.Text(elem_id="extensions_update_list", visible=False).style(container=False)
|
||||
extensions_disabled_list = gr.Text(elem_id="extensions_disabled_list", visible=False, container=False)
|
||||
extensions_update_list = gr.Text(elem_id="extensions_update_list", visible=False, container=False)
|
||||
with gr.Tabs(elem_id="tabs_extensions"):
|
||||
with gr.TabItem("Manage extensions", id="manage"):
|
||||
with gr.Row(elem_id="extensions_installed_top"):
|
||||
|
||||
@@ -448,13 +448,13 @@ def create_ui(container, button_parent, tabname, skip_indexing = False):
|
||||
btn_save_desc = gr.Button('Save', elem_classes=['small-button'])
|
||||
btn_delete_desc = gr.Button('Delete', elem_classes=['small-button'])
|
||||
with gr.Tab('Model metadata'):
|
||||
info = gr.JSON({}, show_label=False, lines=8)
|
||||
info = gr.JSON({}, show_label=False)
|
||||
ui.details_components.append(info)
|
||||
with gr.Row():
|
||||
btn_save_info = gr.Button('Save', elem_classes=['small-button'])
|
||||
btn_delete_info = gr.Button('Delete', elem_classes=['small-button'])
|
||||
with gr.Tab('Embedded metadata'):
|
||||
meta = gr.JSON({}, show_label=False, lines=8)
|
||||
meta = gr.JSON({}, show_label=False)
|
||||
ui.details_components.append(meta)
|
||||
|
||||
with ui.tabs:
|
||||
|
||||
@@ -17,7 +17,7 @@ search_metadata_civit = None
|
||||
def create_ui():
|
||||
dummy_component = gr.Label(visible=False)
|
||||
|
||||
with gr.Row(id="models_tab", elem_id="models_tab"):
|
||||
with gr.Row(elem_id="models_tab"):
|
||||
with gr.Column(elem_id='models_output_container', scale=1):
|
||||
# models_output = gr.Text(elem_id="models_output", value="", show_label=False)
|
||||
gr.HTML(elem_id="models_progress", value="")
|
||||
@@ -69,7 +69,7 @@ def create_ui():
|
||||
)
|
||||
|
||||
with gr.Tab(label="Merge"):
|
||||
with gr.Row().style(equal_height=False):
|
||||
with gr.Row(equal_height=False):
|
||||
with gr.Column(variant='compact'):
|
||||
with FormRow():
|
||||
custom_name = gr.Textbox(label="New model name")
|
||||
@@ -380,14 +380,14 @@ def create_ui():
|
||||
global search_metadata_civit # pylint: disable=global-statement
|
||||
search_metadata_civit = civit_search_metadata
|
||||
|
||||
with gr.Row(style={'margin-top': '1em'}):
|
||||
with gr.Row():
|
||||
gr.HTML('<h2>Fetch information</h2>Fetches preview and metadata information for all models with missing information<br>Models with existing previews and information are not updated<br>')
|
||||
with gr.Row():
|
||||
civit_previews_btn = gr.Button(value="Start", variant='primary')
|
||||
with gr.Row():
|
||||
civit_previews_rehash = gr.Checkbox(value=True, label="Check alternative hash")
|
||||
|
||||
with gr.Row(style={'margin-top': '1em'}):
|
||||
with gr.Row():
|
||||
gr.HTML('<h2>Search for models</h2>Select a model, model version and and model variant from the search results to download<br>')
|
||||
with gr.Row():
|
||||
with gr.Column(scale=1):
|
||||
|
||||
@@ -19,7 +19,7 @@ def submit_click(tab_index, extras_image, image_batch, extras_batch_input_dir, e
|
||||
|
||||
def create_ui():
|
||||
tab_index = gr.State(value=0) # pylint: disable=abstract-class-instantiated
|
||||
with gr.Row().style(equal_height=False, variant='compact'):
|
||||
with gr.Row(equal_height=False, variant='compact'):
|
||||
with gr.Column(variant='compact'):
|
||||
with gr.Tabs(elem_id="mode_extras"):
|
||||
with gr.TabItem('Single Image', id="single_image", elem_id="extras_single_tab") as tab_single:
|
||||
|
||||
+5
-7
@@ -11,10 +11,10 @@ import modules.errors
|
||||
def create_ui(txt2img_preview_params):
|
||||
dummy_component = gr.Label(visible=False)
|
||||
|
||||
with gr.Row(id="train_tab", elem_id="train_tab"):
|
||||
with gr.Row(elem_id="train_tab"):
|
||||
with gr.Column(elem_id='train_output_container', scale=1):
|
||||
train_output = gr.Text(elem_id="train_output", value="", show_label=False)
|
||||
gr.Gallery(label='Output', show_label=False, elem_id='train_gallery').style(columns=1)
|
||||
gr.Gallery(label='Output', show_label=False, elem_id='train_gallery', columns=1)
|
||||
gr.HTML(elem_id="train_progress", value="")
|
||||
train_outcome = gr.HTML(elem_id="train_error", value="")
|
||||
|
||||
@@ -33,7 +33,6 @@ def create_ui(txt2img_preview_params):
|
||||
with gr.Column(elem_id='train_input_container', scale=3):
|
||||
|
||||
with gr.Tabs(elem_id="train_tabs"):
|
||||
|
||||
def gr_show(visible=True):
|
||||
return {"visible": visible, "__type__": "update"}
|
||||
|
||||
@@ -48,7 +47,7 @@ def create_ui(txt2img_preview_params):
|
||||
### preprocess tab
|
||||
|
||||
with gr.Tab(label="Preprocess images", id="preprocess_images") as tab_preprocess:
|
||||
tab_preprocess.select(fn=lambda x: train_tab_change('pp'), inputs=[], outputs=[action_pp, action_ti, action_hn])
|
||||
tab_preprocess.select(fn=lambda: train_tab_change('pp'), inputs=[], outputs=[action_pp, action_ti, action_hn])
|
||||
process_src = gr.Textbox(label='Source directory')
|
||||
process_dst = gr.Textbox(label='Destination directory')
|
||||
with gr.Row():
|
||||
@@ -133,9 +132,8 @@ def create_ui(txt2img_preview_params):
|
||||
)
|
||||
|
||||
### train embedding tab
|
||||
|
||||
with gr.Tab(label="Train embedding", id="train_embedding_tab") as tab_ti:
|
||||
tab_ti.select(fn=lambda x: train_tab_change('ti'), inputs=[], outputs=[action_pp, action_ti, action_hn])
|
||||
tab_ti.select(fn=lambda: train_tab_change('ti'), inputs=[], outputs=[action_pp, action_ti, action_hn])
|
||||
def get_textual_inversion_template_names():
|
||||
return sorted(textual_inversion.textual_inversion_templates)
|
||||
|
||||
@@ -244,7 +242,7 @@ def create_ui(txt2img_preview_params):
|
||||
### train hypernetwork tab
|
||||
|
||||
with gr.Tab(label="Train hypernetwork", id="train_hypernetwork_tab") as tab_hn:
|
||||
tab_hn.select(fn=lambda x: train_tab_change('hn'), inputs=[], outputs=[action_pp, action_ti, action_hn])
|
||||
tab_hn.select(fn=lambda: train_tab_change('hn'), inputs=[], outputs=[action_pp, action_ti, action_hn])
|
||||
gr.Markdown('## Select existing embedding to continue training or create a new one')
|
||||
with FormRow():
|
||||
with gr.Column():
|
||||
|
||||
@@ -20,7 +20,7 @@ class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing):
|
||||
|
||||
with gr.TabItem('Scale to', elem_id="extras_scale_to_tab") as tab_scale_to:
|
||||
with FormRow():
|
||||
with gr.Row(elem_id="upscaling_column_size", scale=4):
|
||||
with gr.Row(elem_id="upscaling_column_size"):
|
||||
upscaling_resize_w = gr.Slider(minimum=64, maximum=4096, step=8, label="Width", value=512, elem_id="extras_upscaling_resize_w")
|
||||
upscaling_resize_h = gr.Slider(minimum=64, maximum=4096, step=8, label="Height", value=512, elem_id="extras_upscaling_resize_h")
|
||||
upscaling_res_switch_btn = ToolButton(value=symbols.switch, elem_id="upscaling_res_switch_btn")
|
||||
|
||||
Reference in New Issue
Block a user