diff --git a/extensions-builtin/sd-webui-controlnet b/extensions-builtin/sd-webui-controlnet
index 7b731d157..1b7ae7dbe 160000
--- a/extensions-builtin/sd-webui-controlnet
+++ b/extensions-builtin/sd-webui-controlnet
@@ -1 +1 @@
-Subproject commit 7b731d15776217eababd636461a6b3a25470670b
+Subproject commit 1b7ae7dbec8ed4d9228f8849a31e49eef51ee1b8
diff --git a/modules/shared.py b/modules/shared.py
index 941781fe3..111050e9c 100644
--- a/modules/shared.py
+++ b/modules/shared.py
@@ -458,9 +458,9 @@ options_templates.update(options_section(('saving-images', "Image Options"), {
"grid_save": OptionInfo(True, "Save all generated image grids"),
"grid_format": OptionInfo('jpg', 'File format', gr.Dropdown, {"choices": ["jpg", "png", "webp", "tiff", "jp2"]}),
"n_rows": OptionInfo(-1, "Row count", gr.Slider, {"minimum": -1, "maximum": 16, "step": 1}),
- "grid_background": OptionInfo("#000000", "Background color", ui_components.FormColorPicker, {}),
+ "grid_background": OptionInfo("#000000", "Background color", gr.ColorPicker, {}),
"font": OptionInfo("", "Font file"),
- "font_color": OptionInfo("#FFFFFF", "Font color", ui_components.FormColorPicker, {}),
+ "font_color": OptionInfo("#FFFFFF", "Font color", gr.ColorPicker, {}),
"save_sep_options": OptionInfo("
Intermediate Image Saving
", "", gr.HTML),
"save_init_img": OptionInfo(False, "Save init images"),
@@ -588,7 +588,7 @@ options_templates.update(options_section(('postprocessing', "Postprocessing"), {
"postprocessing_sep_img2img": OptionInfo("Img2Img & Inpainting
", "", gr.HTML),
"img2img_color_correction": OptionInfo(False, "Apply color correction"),
"img2img_fix_steps": OptionInfo(False, "For image processing do exact number of steps as specified", gr.Checkbox, { "visible": False }),
- "img2img_background_color": OptionInfo("#ffffff", "Image transparent color fill", ui_components.FormColorPicker, {}),
+ "img2img_background_color": OptionInfo("#ffffff", "Image transparent color fill", gr.ColorPicker, {}),
"inpainting_mask_weight": OptionInfo(1.0, "Inpainting conditioning mask strength", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}),
"initial_noise_multiplier": OptionInfo(1.0, "Noise multiplier for image processing", gr.Slider, {"minimum": 0.1, "maximum": 1.5, "step": 0.01}),
"img2img_extra_noise": OptionInfo(0.0, "Extra noise multiplier for img2img", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}),
diff --git a/modules/ui.py b/modules/ui.py
index 7be951525..cffc534ee 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -5,7 +5,6 @@ import gradio.routes
import gradio.utils
from modules.call_queue import wrap_gradio_call
from modules import timer, gr_hijack, shared, theme, sd_models, script_callbacks, modelloader, ui_common, ui_loadsave, ui_symbols, ui_javascript, generation_parameters_copypaste
-from modules.ui_components import FormRow
from modules.paths import script_path, data_path # pylint: disable=unused-import
from modules.dml import directml_override_opts
import modules.scripts
@@ -185,11 +184,11 @@ def create_ui(startup_timer = None):
res = comp(label=info.label, value=fun(), elem_id=elem_id, **args)
ui_common.create_refresh_button(res, info.refresh, info.component_args, f"refresh_{key}")
else:
- with FormRow():
+ with gr.Row():
res = comp(label=info.label, value=fun(), elem_id=elem_id, **args)
ui_common.create_refresh_button(res, info.refresh, info.component_args, f"refresh_{key}")
elif info.folder is not None:
- with FormRow():
+ with gr.Row():
res = comp(label=info.label, value=fun(), elem_id=elem_id, elem_classes="folder-selector", **args)
# ui_common.create_browse_button(res, f"folder_{key}")
else:
diff --git a/modules/ui_common.py b/modules/ui_common.py
index 84e374f48..634ff4e1b 100644
--- a/modules/ui_common.py
+++ b/modules/ui_common.py
@@ -9,7 +9,7 @@ import gradio as gr
from modules import call_queue, shared, prompt_parser
from modules import generation_parameters_copypaste
from modules import ui_sections
-from modules.ui_components import FormRow, ToolButton
+from modules.ui_components import ToolButton
import modules.ui_symbols as symbols
import modules.images
import modules.script_callbacks
@@ -314,7 +314,7 @@ def create_browse_button(browse_component, elem_id):
def create_override_inputs(tab): # pylint: disable=unused-argument
- with FormRow(elem_id=f"{tab}_override_settings_row"):
+ with gr.Row(elem_id=f"{tab}_override_settings_row"):
override_settings = gr.Dropdown([], value=None, label="Override settings", visible=False, elem_id=f"{tab}_override_settings", multiselect=True)
override_settings.change(fn=lambda x: gr.Dropdown.update(visible=len(x) > 0), inputs=[override_settings], outputs=[override_settings])
return override_settings
diff --git a/modules/ui_components.py b/modules/ui_components.py
index f9aed5c6c..f3192fb9a 100644
--- a/modules/ui_components.py
+++ b/modules/ui_components.py
@@ -20,42 +20,42 @@ class ToolButton(FormComponent, gr.Button):
return "button"
-class FormRow(FormComponent, gr.Row):
+class FormRow(FormComponent, gr.Row): # unused
"""Same as gr.Row but fits inside gradio forms"""
def get_block_name(self):
return "row"
-class FormColumn(FormComponent, gr.Column):
+class FormColumn(FormComponent, gr.Column): # unused
"""Same as gr.Column but fits inside gradio forms"""
def get_block_name(self):
return "column"
-class FormGroup(FormComponent, gr.Group):
+class FormGroup(FormComponent, gr.Group): # unused
"""Same as gr.Row but fits inside gradio forms"""
def get_block_name(self):
return "group"
-class FormHTML(FormComponent, gr.HTML):
+class FormHTML(FormComponent, gr.HTML): # unused
"""Same as gr.HTML but fits inside gradio forms"""
def get_block_name(self):
return "html"
-class FormColorPicker(FormComponent, gr.ColorPicker):
+class FormColorPicker(FormComponent, gr.ColorPicker): # unused
"""Same as gr.ColorPicker but fits inside gradio forms"""
def get_block_name(self):
return "colorpicker"
-class DropdownMulti(FormComponent, gr.Dropdown):
+class DropdownMulti(FormComponent, gr.Dropdown): # TODO
"""Same as gr.Dropdown but always multiselect"""
def __init__(self, **kwargs):
super().__init__(multiselect=True, **kwargs)
@@ -64,7 +64,7 @@ class DropdownMulti(FormComponent, gr.Dropdown):
return "dropdown"
-class DropdownEditable(FormComponent, gr.Dropdown):
+class DropdownEditable(FormComponent, gr.Dropdown): # unused
"""Same as gr.Dropdown but allows editing value"""
def __init__(self, **kwargs):
super().__init__(allow_custom_value=True, **kwargs)
@@ -73,7 +73,7 @@ class DropdownEditable(FormComponent, gr.Dropdown):
return "dropdown"
-class InputAccordion(gr.Checkbox):
+class InputAccordion(gr.Checkbox): # unused
"""A gr.Accordion that can be used as an input - returns True if open, False if closed.
Actaully just a hidden checkbox, but creates an accordion that follows and is followed by the state of the checkbox.
"""
@@ -119,7 +119,7 @@ class InputAccordion(gr.Checkbox):
return "checkbox"
-class ResizeHandleRow(gr.Row):
+class ResizeHandleRow(gr.Row): # unusued
"""Same as gr.Row but fits inside gradio forms"""
def __init__(self, **kwargs):
diff --git a/modules/ui_img2img.py b/modules/ui_img2img.py
index 708b35769..331b63263 100644
--- a/modules/ui_img2img.py
+++ b/modules/ui_img2img.py
@@ -4,7 +4,6 @@ import gradio as gr
import numpy as np
from modules.call_queue import wrap_gradio_gpu_call, wrap_queued_call
from modules import timer, shared, ui_common, ui_sections, generation_parameters_copypaste
-from modules.ui_components import FormRow, FormGroup
def process_interrogate(interrogation_function, mode, ii_input_files, ii_input_dir, ii_output_dir, *ii_singles):
@@ -42,12 +41,12 @@ def create_ui():
img2img_prompt, img2img_prompt_styles, img2img_negative_prompt, submit, img2img_paste, img2img_extra_networks_button, img2img_token_counter, img2img_token_button, img2img_negative_token_counter, img2img_negative_token_button = ui_sections.create_toprow(is_img2img=True, id_part="img2img")
img2img_prompt_img = gr.File(label="", elem_id="img2img_prompt_image", file_count="single", type="binary", visible=False)
- with FormRow(variant='compact', elem_id="img2img_extra_networks", visible=False) as extra_networks_ui:
+ with gr.Row(variant='compact', elem_id="img2img_extra_networks", visible=False) as extra_networks_ui:
from modules import ui_extra_networks
extra_networks_ui_img2img = ui_extra_networks.create_ui(extra_networks_ui, img2img_extra_networks_button, 'img2img', skip_indexing=shared.opts.extra_network_skip_indexing)
timer.startup.record('ui-en')
- with FormRow(elem_id="img2img_interface", equal_height=False):
+ with gr.Row(elem_id="img2img_interface", equal_height=False):
with gr.Column(variant='compact', elem_id="img2img_settings"):
copy_image_buttons = []
copy_image_destinations = {}
@@ -119,7 +118,7 @@ def create_ui():
button.click(fn=copy_image, inputs=[elem], outputs=[copy_image_destinations[name]])
button.click(fn=lambda: None, _js=f"switch_to_{name.replace(' ', '_')}", inputs=[], outputs=[])
- with FormGroup(elem_classes="settings-accordion"):
+ with gr.Group(elem_classes="settings-accordion"):
steps, sampler_index = ui_sections.create_sampler_inputs('img2img')
resize_mode, resize_name, width, height, scale_by, selected_scale_tab = ui_sections.create_resize_inputs('img2img', [init_img, sketch])
@@ -127,19 +126,19 @@ def create_ui():
seed, reuse_seed, subseed, reuse_subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w = ui_sections.create_seed_inputs('img2img')
with gr.Accordion(open=False, label="Denoise", elem_classes=["small-accordion"], elem_id="img2img_denoise_group"):
- with FormRow():
+ with gr.Row():
denoising_strength = gr.Slider(minimum=0.0, maximum=0.99, step=0.01, label='Denoising strength', value=0.50, elem_id="img2img_denoising_strength")
refiner_start = gr.Slider(minimum=0.0, maximum=1.0, step=0.05, label='Denoise start', value=0.0, elem_id="img2img_refiner_start")
cfg_scale, clip_skip, image_cfg_scale, diffusers_guidance_rescale, sag_scale, full_quality, restore_faces, tiling, hdr_clamp, hdr_boundary, hdr_threshold, hdr_center, hdr_channel_shift, hdr_full_shift, hdr_maximize, hdr_max_center, hdr_max_boundry = ui_sections.create_advanced_inputs('img2img')
- # with FormGroup(elem_id="inpaint_controls", visible=False) as inpaint_controls:
+ # with gr.Group(elem_id="inpaint_controls", visible=False) as inpaint_controls:
with gr.Accordion(open=True, label="Mask", elem_classes=["small-accordion"], elem_id="img2img_mask_group") as inpaint_controls:
- with FormRow():
+ with gr.Row():
mask_blur = gr.Slider(label='Blur', minimum=0, maximum=64, step=1, value=4, elem_id="img2img_mask_blur")
inpaint_full_res_padding = gr.Slider(label='Padding', minimum=0, maximum=256, step=4, value=32, elem_id="img2img_inpaint_full_res_padding")
mask_alpha = gr.Slider(label="Alpha", minimum=0.0, maximum=1.0, step=0.05, value=1.0, elem_id="img2img_mask_alpha")
- with FormRow():
+ with gr.Row():
inpainting_mask_invert = gr.Radio(label='Mode', choices=['masked', 'inverse'], value='masked', type="index", elem_id="img2img_mask_mode")
inpaint_full_res = gr.Radio(label="Inpaint area", choices=["full", "masked"], type="index", value="full", elem_id="img2img_inpaint_full_res")
inpainting_fill = gr.Radio(label='Masked content', choices=['fill', 'original', 'noise', 'nothing'], value='original', type="index", elem_id="img2img_inpainting_fill", visible=shared.backend == shared.Backend.ORIGINAL)
@@ -152,7 +151,7 @@ def create_ui():
override_settings = ui_common.create_override_inputs('img2img')
- with FormGroup(elem_id="img2img_script_container"):
+ with gr.Group(elem_id="img2img_script_container"):
img2img_script_inputs = modules.scripts.scripts_img2img.setup_ui(parent='img2img', accordion=True)
img2img_gallery, img2img_generation_info, img2img_html_info, _img2img_html_info_formatted, img2img_html_log = ui_common.create_output_panel("img2img", prompt=None)
diff --git a/modules/ui_models.py b/modules/ui_models.py
index e7c2b216d..19a2c3632 100644
--- a/modules/ui_models.py
+++ b/modules/ui_models.py
@@ -5,7 +5,7 @@ import inspect
from datetime import datetime
import gradio as gr
from modules import sd_models, sd_vae, extras
-from modules.ui_components import FormRow, ToolButton
+from modules.ui_components import ToolButton
from modules.ui_common import create_refresh_button
from modules.call_queue import wrap_gradio_gpu_call
from modules.shared import opts, log, req, readfile, max_workers
@@ -78,70 +78,70 @@ def create_ui():
with gr.Row(equal_height=False):
with gr.Column(variant='compact'):
- with FormRow():
+ with gr.Row():
custom_name = gr.Textbox(label="New model name")
- with FormRow():
+ with gr.Row():
merge_mode = gr.Dropdown(choices=merge_methods.__all__, value="weighted_sum", label="Interpolation Method")
merge_mode_docs = gr.HTML(value=getattr(merge_methods, "weighted_sum", "").__doc__.replace("\n", "
"))
- with FormRow():
+ with gr.Row():
primary_model_name = gr.Dropdown(sd_model_choices(), label="Primary model", value="None")
create_refresh_button(primary_model_name, sd_models.list_models, lambda: {"choices": sd_model_choices()}, "refresh_checkpoint_A")
secondary_model_name = gr.Dropdown(sd_model_choices(), label="Secondary model", value="None")
create_refresh_button(secondary_model_name, sd_models.list_models, lambda: {"choices": sd_model_choices()}, "refresh_checkpoint_B")
tertiary_model_name = gr.Dropdown(sd_model_choices(), label="Tertiary model", value="None", visible=False)
tertiary_refresh = create_refresh_button(tertiary_model_name, sd_models.list_models, lambda: {"choices": sd_model_choices()}, "refresh_checkpoint_C", visible=False)
- with FormRow():
+ with gr.Row():
with gr.Tabs() as tabs:
with gr.TabItem(label="Simple Merge", id=0):
- with FormRow():
+ with gr.Row():
alpha = gr.Slider(minimum=0.0, maximum=1.0, step=0.05, label='Alpha Ratio', value=0.5)
beta = gr.Slider(minimum=0.0, maximum=1.0, step=0.05, label='Beta Ratio', value=None, visible=False)
with gr.TabItem(label="Preset Block Merge", id=1):
- with FormRow():
+ with gr.Row():
sdxl = gr.Checkbox(label="SDXL")
- with FormRow():
+ with gr.Row():
alpha_preset = gr.Dropdown(
choices=["None"] + list(BLOCK_WEIGHTS_PRESETS.keys()), value=None,
label="ALPHA Block Weight Preset", multiselect=True, max_choices=2)
alpha_preset_lambda = gr.Slider(minimum=0.0, maximum=1.0, step=0.05, label='Preset Interpolation Ratio', value=None, visible=False)
apply_preset = ToolButton('⇨', visible=True)
- with FormRow():
+ with gr.Row():
beta_preset = gr.Dropdown(choices=["None"] + list(BLOCK_WEIGHTS_PRESETS.keys()), value=None, label="BETA Block Weight Preset", multiselect=True, max_choices=2, interactive=True, visible=False)
beta_preset_lambda = gr.Slider(minimum=0.0, maximum=1.0, step=0.05, label='Preset Interpolation Ratio', value=None, interactive=True, visible=False)
beta_apply_preset = ToolButton('⇨', interactive=True, visible=False)
with gr.TabItem(label="Manual Block Merge", id=2):
- with FormRow():
+ with gr.Row():
alpha_label = gr.Markdown("# Alpha")
- with FormRow():
+ with gr.Row():
alpha_base = gr.Textbox(value=None, label="Base", min_width=70, scale=1)
alpha_in_blocks = gr.Textbox(value=None, label="In Blocks", scale=15)
alpha_mid_block = gr.Textbox(value=None, label="Mid Block", min_width=80, scale=1)
alpha_out_blocks = gr.Textbox(value=None, label="Out Block", scale=15)
- with FormRow():
+ with gr.Row():
beta_label = gr.Markdown("# Beta", visible=False)
- with FormRow():
+ with gr.Row():
beta_base = gr.Textbox(value=None, label="Base", min_width=70, scale=1, interactive=True, visible=False)
beta_in_blocks = gr.Textbox(value=None, label="In Blocks", interactive=True, scale=15, visible=False)
beta_mid_block = gr.Textbox(value=None, label="Mid Block", min_width=80, interactive=True, scale=1, visible=False)
beta_out_blocks = gr.Textbox(value=None, label="Out Block", interactive=True, scale=15, visible=False)
- with FormRow():
+ with gr.Row():
overwrite = gr.Checkbox(label="Overwrite model")
- with FormRow():
+ with gr.Row():
save_metadata = gr.Checkbox(value=True, label="Save metadata")
- with FormRow():
+ with gr.Row():
weights_clip = gr.Checkbox(label="Weights clip")
prune = gr.Checkbox(label="Prune", value=True, visible=False)
- with FormRow():
+ with gr.Row():
re_basin = gr.Checkbox(label="ReBasin")
re_basin_iterations = gr.Slider(minimum=0, maximum=25, step=1, label='Number of ReBasin Iterations', value=None, visible=False)
- with FormRow():
+ with gr.Row():
checkpoint_format = gr.Radio(choices=["ckpt", "safetensors"], value="safetensors", visible=False, label="Model format")
- with FormRow():
+ with gr.Row():
precision = gr.Radio(choices=["fp16", "fp32"], value="fp16", label="Model precision")
- with FormRow():
+ with gr.Row():
device = gr.Radio(choices=["cpu", "shuffle", "gpu"], value="cpu", label="Merge Device")
unload = gr.Checkbox(label="Unload Current Model from VRAM", value=False, visible=False)
- with FormRow():
+ with gr.Row():
bake_in_vae = gr.Dropdown(choices=["None"] + list(sd_vae.vae_dict), value="None", interactive=True, label="Replace VAE")
create_refresh_button(bake_in_vae, sd_vae.refresh_vae_list,
lambda: {"choices": ["None"] + list(sd_vae.vae_dict)},
diff --git a/modules/ui_sections.py b/modules/ui_sections.py
index d6083686f..339897bab 100644
--- a/modules/ui_sections.py
+++ b/modules/ui_sections.py
@@ -1,6 +1,6 @@
import gradio as gr
from modules import shared, modelloader, ui_symbols, ui_common, sd_samplers
-from modules.ui_components import FormRow, FormGroup, ToolButton, FormHTML
+from modules.ui_components import ToolButton
def create_toprow(is_img2img: bool = False, id_part: str = None):
@@ -65,7 +65,7 @@ def create_interrogate_buttons(tab):
def create_sampler_inputs(tab, accordion=True):
with gr.Accordion(open=False, label="Sampler", elem_id=f"{tab}_sampler", elem_classes=["small-accordion"]) if accordion else gr.Group():
- with FormRow(elem_id=f"{tab}_row_sampler"):
+ with gr.Row(elem_id=f"{tab}_row_sampler"):
sd_samplers.set_samplers()
steps, sampler_index = create_sampler_and_steps_selection(sd_samplers.samplers, tab)
return steps, sampler_index
@@ -73,7 +73,7 @@ def create_sampler_inputs(tab, accordion=True):
def create_batch_inputs(tab):
with gr.Accordion(open=False, label="Batch", elem_id=f"{tab}_batch", elem_classes=["small-accordion"]):
- with FormRow(elem_id=f"{tab}_row_batch"):
+ with gr.Row(elem_id=f"{tab}_row_batch"):
batch_count = gr.Slider(minimum=1, step=1, label='Batch count', value=1, elem_id=f"{tab}_batch_count")
batch_size = gr.Slider(minimum=1, maximum=32, step=1, label='Batch size', value=1, elem_id=f"{tab}_batch_size")
batch_switch_btn = ToolButton(value=ui_symbols.switch, elem_id=f"{tab}_batch_switch_btn", label="Switch dims")
@@ -83,16 +83,16 @@ def create_batch_inputs(tab):
def create_seed_inputs(tab, reuse_visible=True):
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"):
+ with gr.Row(elem_id=f"{tab}_seed_row", variant="compact"):
seed = gr.Number(label='Initial seed', value=-1, elem_id=f"{tab}_seed", container=True)
random_seed = ToolButton(ui_symbols.random, elem_id=f"{tab}_random_seed", label='Random seed')
reuse_seed = ToolButton(ui_symbols.reuse, elem_id=f"{tab}_reuse_seed", label='Reuse seed', visible=reuse_visible)
- with FormRow(elem_id=f"{tab}_subseed_row", variant="compact", visible=shared.backend==shared.Backend.ORIGINAL):
+ with gr.Row(elem_id=f"{tab}_subseed_row", variant="compact", visible=shared.backend==shared.Backend.ORIGINAL):
subseed = gr.Number(label='Variation', value=-1, elem_id=f"{tab}_subseed", container=True)
random_subseed = ToolButton(ui_symbols.random, elem_id=f"{tab}_random_subseed")
reuse_subseed = ToolButton(ui_symbols.reuse, elem_id=f"{tab}_reuse_subseed", visible=reuse_visible)
subseed_strength = gr.Slider(label='Variation strength', value=0.0, minimum=0, maximum=1, step=0.01, elem_id=f"{tab}_subseed_strength")
- with FormRow(visible=False):
+ with gr.Row(visible=False):
seed_resize_from_w = gr.Slider(minimum=0, maximum=4096, step=8, label="Resize seed from width", value=0, elem_id=f"{tab}_seed_resize_from_w")
seed_resize_from_h = gr.Slider(minimum=0, maximum=4096, step=8, label="Resize seed from height", value=0, elem_id=f"{tab}_seed_resize_from_h")
random_seed.click(fn=lambda: [-1, -1], show_progress=False, inputs=[], outputs=[seed, subseed])
@@ -103,29 +103,29 @@ def create_seed_inputs(tab, reuse_visible=True):
def create_advanced_inputs(tab):
with gr.Accordion(open=False, label="Advanced", elem_id=f"{tab}_advanced", elem_classes=["small-accordion"]):
with gr.Group():
- with FormRow():
+ with gr.Row():
cfg_scale = gr.Slider(minimum=0.0, maximum=30.0, step=0.1, label='CFG scale', value=6.0, elem_id=f"{tab}_cfg_scale")
image_cfg_scale = gr.Slider(minimum=0.0, maximum=30.0, step=0.1, label='Secondary CFG scale', value=6.0, elem_id=f"{tab}_image_cfg_scale")
- with FormRow():
+ with gr.Row():
diffusers_guidance_rescale = gr.Slider(minimum=0.0, maximum=1.0, step=0.05, label='Guidance rescale', value=0.7, elem_id=f"{tab}_image_cfg_rescale", visible=shared.backend == shared.Backend.DIFFUSERS)
diffusers_sag_scale = gr.Slider(minimum=0.0, maximum=1.0, step=0.05, label='Self-attention guidance', value=0.0, elem_id=f"{tab}_image_sag_scale", visible=shared.backend == shared.Backend.DIFFUSERS)
- with FormRow():
+ with gr.Row():
clip_skip = gr.Slider(label='CLIP skip', value=1, minimum=1, maximum=14, step=1, elem_id=f"{tab}_clip_skip", interactive=True)
with gr.Group():
- with FormRow():
+ with gr.Row():
full_quality = gr.Checkbox(label='Full quality', value=True, elem_id=f"{tab}_full_quality")
restore_faces = gr.Checkbox(label='Face restore', value=False, visible=len(shared.face_restorers) > 1, elem_id=f"{tab}_restore_faces")
tiling = gr.Checkbox(label='Tiling', value=False, elem_id=f"{tab}_tiling", visible=shared.backend == shared.Backend.ORIGINAL)
with gr.Group(visible=shared.backend == shared.Backend.DIFFUSERS):
- with FormRow():
+ with gr.Row():
hdr_clamp = gr.Checkbox(label='HDR clamp', value=False, elem_id=f"{tab}_hdr_clamp")
hdr_boundary = gr.Slider(minimum=0.0, maximum=10.0, step=0.1, value=4.0, label='Range', elem_id=f"{tab}_hdr_boundary")
hdr_threshold = gr.Slider(minimum=0.0, maximum=1.0, step=0.01, value=0.95, label='Threshold', elem_id=f"{tab}_hdr_threshold")
- with FormRow():
+ with gr.Row():
hdr_center = gr.Checkbox(label='HDR center', value=False, elem_id=f"{tab}_hdr_center")
hdr_channel_shift = gr.Slider(minimum=0.0, maximum=2.0, step=0.1, value=1.0, label='Channel shift', elem_id=f"{tab}_hdr_channel_shift")
hdr_full_shift = gr.Slider(minimum=0.0, maximum=2.0, step=0.1, value=1, label='Full shift', elem_id=f"{tab}_hdr_full_shift")
- with FormRow():
+ with gr.Row():
hdr_maximize = gr.Checkbox(label='HDR maximize', value=False, elem_id=f"{tab}_hdr_maximize")
hdr_max_center = gr.Slider(minimum=0.0, maximum=2.0, step=0.1, value=0.6, label='Center', elem_id=f"{tab}_hdr_max_center")
hdr_max_boundry = gr.Slider(minimum=0.5, maximum=2.0, step=0.1, value=1.0, label='Max Range', elem_id=f"{tab}_hdr_max_boundry")
@@ -146,23 +146,23 @@ def create_sampler_and_steps_selection(choices, tabname):
shared.opts.data['schedulers_rescale_betas'] = 'rescale beta' in sampler_options
shared.opts.save(shared.config_filename, silent=True)
- with FormRow(elem_classes=['flex-break']):
+ with gr.Row(elem_classes=['flex-break']):
sampler_index = gr.Dropdown(label='Sampling method', elem_id=f"{tabname}_sampling", choices=[x.name for x in choices], value='Default', type="index")
steps = gr.Slider(minimum=1, maximum=99, step=1, label="Sampling steps", elem_id=f"{tabname}_steps", value=20)
if shared.backend == shared.Backend.ORIGINAL:
- with FormRow(elem_classes=['flex-break']):
+ with gr.Row(elem_classes=['flex-break']):
choices = ['brownian noise', 'discard penultimate sigma']
values = []
values += ['brownian noise'] if shared.opts.data.get('schedulers_brownian_noise', False) else []
values += ['discard penultimate sigma'] if shared.opts.data.get('schedulers_discard_penultimate', True) else []
sampler_options = gr.CheckboxGroup(label='Sampler options', choices=choices, value=values, type='value')
- with FormRow(elem_classes=['flex-break']):
+ with gr.Row(elem_classes=['flex-break']):
shared.opts.data['schedulers_sigma'] = shared.opts.data.get('schedulers_sigma', 'default')
sampler_algo = gr.Radio(label='Sigma algorithm', choices=['default', 'karras', 'exponential', 'polyexponential'], value=shared.opts.data['schedulers_sigma'], type='value')
sampler_options.change(fn=set_sampler_original_options, inputs=[sampler_options, sampler_algo], outputs=[])
sampler_algo.change(fn=set_sampler_original_options, inputs=[sampler_options, sampler_algo], outputs=[])
else:
- with FormRow(elem_classes=['flex-break']):
+ with gr.Row(elem_classes=['flex-break']):
choices = ['karras', 'dynamic threshold', 'low order', 'rescale beta']
values = []
values += ['karras'] if shared.opts.data.get('schedulers_use_karras', True) else []
@@ -176,30 +176,30 @@ def create_sampler_and_steps_selection(choices, tabname):
def create_hires_inputs(tab):
with gr.Accordion(open=False, label="Second pass", elem_id=f"{tab}_second_pass", elem_classes=["small-accordion"]):
- with FormGroup():
- with FormRow(elem_id=f"{tab}_hires_row1"):
+ with gr.Group():
+ with gr.Row(elem_id=f"{tab}_hires_row1"):
enable_hr = gr.Checkbox(label='Enable second pass', value=False, elem_id=f"{tab}_enable_hr")
- with FormRow(elem_id=f"{tab}_hires_row2"):
+ with gr.Row(elem_id=f"{tab}_hires_row2"):
hr_sampler_index = gr.Dropdown(label='Secondary sampler', elem_id=f"{tab}_sampling_alt", choices=[x.name for x in sd_samplers.samplers], value='Default', type="index")
denoising_strength = gr.Slider(minimum=0.0, maximum=0.99, step=0.01, label='Denoising strength', value=0.5, elem_id=f"{tab}_denoising_strength")
- with FormRow(elem_id=f"{tab}_hires_finalres", variant="compact"):
- hr_final_resolution = FormHTML(value="", elem_id=f"{tab}_hr_finalres", label="Upscaled resolution", interactive=False)
- with FormRow(elem_id=f"{tab}_hires_fix_row1", variant="compact"):
+ with gr.Row(elem_id=f"{tab}_hires_finalres", variant="compact"):
+ hr_final_resolution = gr.HTML(value="", elem_id=f"{tab}_hr_finalres", label="Upscaled resolution", interactive=False)
+ with gr.Row(elem_id=f"{tab}_hires_fix_row1", variant="compact"):
hr_upscaler = gr.Dropdown(label="Upscaler", elem_id=f"{tab}_hr_upscaler", choices=[*shared.latent_upscale_modes, *[x.name for x in shared.sd_upscalers]], value=shared.latent_upscale_default_mode)
hr_force = gr.Checkbox(label='Force Hires', value=False, elem_id=f"{tab}_hr_force")
- with FormRow(elem_id=f"{tab}_hires_fix_row2", variant="compact"):
+ with gr.Row(elem_id=f"{tab}_hires_fix_row2", variant="compact"):
hr_second_pass_steps = gr.Slider(minimum=0, maximum=99, step=1, label='Hires steps', elem_id=f"{tab}_steps_alt", value=20)
hr_scale = gr.Slider(minimum=1.0, maximum=8.0, step=0.05, label="Upscale by", value=2.0, elem_id=f"{tab}_hr_scale")
- with FormRow(elem_id=f"{tab}_hires_fix_row3", variant="compact"):
+ with gr.Row(elem_id=f"{tab}_hires_fix_row3", variant="compact"):
hr_resize_x = gr.Slider(minimum=0, maximum=4096, step=8, label="Resize width to", value=0, elem_id=f"{tab}_hr_resize_x")
hr_resize_y = gr.Slider(minimum=0, maximum=4096, step=8, label="Resize height to", value=0, elem_id=f"{tab}_hr_resize_y")
- with FormGroup(visible=shared.backend == shared.Backend.DIFFUSERS):
- with FormRow(elem_id=f"{tab}_refiner_row1", variant="compact"):
+ with gr.Group(visible=shared.backend == shared.Backend.DIFFUSERS):
+ with gr.Row(elem_id=f"{tab}_refiner_row1", variant="compact"):
refiner_start = gr.Slider(minimum=0.0, maximum=1.0, step=0.05, label='Refiner start', value=0.8, elem_id=f"{tab}_refiner_start")
refiner_steps = gr.Slider(minimum=0, maximum=99, step=1, label="Refiner steps", elem_id=f"{tab}_refiner_steps", value=5)
- with FormRow(elem_id=f"{tab}_refiner_row3", variant="compact"):
+ with gr.Row(elem_id=f"{tab}_refiner_row3", variant="compact"):
refiner_prompt = gr.Textbox(value='', label='Secondary prompt', elem_id=f"{tab}_refiner_prompt")
- with FormRow(elem_id="txt2img_refiner_row4", variant="compact"):
+ with gr.Row(elem_id="txt2img_refiner_row4", variant="compact"):
refiner_negative = gr.Textbox(value='', label='Secondary negative prompt', elem_id=f"{tab}_refiner_neg_prompt")
return enable_hr, hr_sampler_index, denoising_strength, hr_final_resolution, hr_upscaler, hr_force, hr_second_pass_steps, hr_scale, hr_resize_x, hr_resize_y, refiner_steps, refiner_start, refiner_prompt, refiner_negative
@@ -223,14 +223,14 @@ def create_resize_inputs(tab, images, scale_visible=True, mode=None, accordion=T
resize_name = gr.Dropdown(label="Resize method", elem_id=f"{tab}_resize_name", choices=([] if not latent else list(shared.latent_upscale_modes)) + [x.name for x in shared.sd_upscalers], value=shared.latent_upscale_default_mode)
ui_common.create_refresh_button(resize_name, modelloader.load_upscalers, lambda: {"choices": modelloader.load_upscalers()}, 'refresh_upscalers')
- with FormRow(visible=True) as _resize_group:
+ with gr.Row(visible=True) as _resize_group:
with gr.Column(elem_id=f"{tab}_column_size"):
selected_scale_tab = gr.State(value=0) # pylint: disable=abstract-class-instantiated
with gr.Tabs():
- with gr.Tab(label="Resize to") as tab_scale_to:
- with FormRow():
+ with gr.Tab(label="Fixed") as tab_scale_to:
+ with gr.Row():
with gr.Column(elem_id=f"{tab}_column_size"):
- with FormRow():
+ with gr.Row():
width = gr.Slider(minimum=64, maximum=8192, step=8, label="Width", value=512, elem_id=f"{tab}_width")
height = gr.Slider(minimum=64, maximum=8192, step=8, label="Height", value=512, elem_id=f"{tab}_height")
res_switch_btn = ToolButton(value=ui_symbols.switch, elem_id=f"{tab}_res_switch_btn")
@@ -238,11 +238,11 @@ def create_resize_inputs(tab, images, scale_visible=True, mode=None, accordion=T
detect_image_size_btn = ToolButton(value=ui_symbols.detect, elem_id=f"{tab}_detect_image_size_btn")
detect_image_size_btn.click(fn=lambda w, h, _: (w or gr.update(), h or gr.update()), _js="currentImg2imgSourceResolution", inputs=[dummy_component, dummy_component, dummy_component], outputs=[width, height], show_progress=False)
- with gr.Tab(label="Resize by") as tab_scale_by:
+ with gr.Tab(label="Scale") as tab_scale_by:
scale_by = gr.Slider(minimum=0.05, maximum=8.0, step=0.05, label="Scale", value=1.0, elem_id=f"{tab}_scale")
if scale_visible:
- with FormRow():
- scale_by_html = FormHTML(resize_from_to_html(0, 0, 0.0), elem_id=f"{tab}_scale_resolution_preview")
+ with gr.Row():
+ scale_by_html = gr.HTML(resize_from_to_html(0, 0, 0.0), elem_id=f"{tab}_scale_resolution_preview")
gr.Slider(label="Unused", elem_id=f"{tab}_unused_scale_by_slider")
button_update_resize_to = gr.Button(visible=False, elem_id=f"{tab}_update_resize_to")
diff --git a/modules/ui_train.py b/modules/ui_train.py
index 17358f395..263adf1bf 100644
--- a/modules/ui_train.py
+++ b/modules/ui_train.py
@@ -1,7 +1,6 @@
import os
import gradio as gr
from modules import script_callbacks, shared
-from modules.ui_components import FormRow
from modules.ui_common import create_refresh_button
from modules.ui_sections import create_sampler_inputs
from modules.call_queue import wrap_gradio_gpu_call
@@ -158,7 +157,7 @@ def create_ui():
return sorted(textual_inversion.textual_inversion_templates)
gr.HTML('Select existing embedding to continue training or create a new one
')
- with FormRow():
+ with gr.Row():
with gr.Column():
with gr.Row():
ti_name = gr.Dropdown(label='Select embedding', choices=sorted(sd_hijack.model_hijack.embedding_db.word_embeddings.keys()))
@@ -174,7 +173,7 @@ def create_ui():
with gr.Box():
gr.HTML('Training parameters
')
ti_learn_rate = gr.Textbox(label='Embedding Learning rate', placeholder="Embedding Learning rate", value="0.005")
- with FormRow():
+ with gr.Row():
ti_clip_grad_mode = gr.Dropdown(value="disabled", label="Gradient Clipping", choices=["disabled", "value", "norm"])
ti_clip_grad_value = gr.Number(label="Gradient clip value", value=0.1)
ti_batch_size = gr.Number(label='Batch size', value=1, precision=0)
@@ -184,7 +183,7 @@ def create_ui():
with gr.Box():
gr.HTML('Training images
')
ti_dataset_directory = gr.Textbox(label='Dataset directory', placeholder="Path to directory with input images")
- with FormRow():
+ with gr.Row():
ti_varsize = gr.Checkbox(label="Do not resize images", value=False)
ti_width = gr.Slider(minimum=64, maximum=2048, step=8, label="Width", value=512)
ti_height = gr.Slider(minimum=64, maximum=2048, step=8, label="Height", value=512)
@@ -192,7 +191,7 @@ def create_ui():
with gr.Box():
gr.HTML('Dataset processing
')
- with FormRow():
+ with gr.Row():
ti_template = gr.Dropdown(label='Prompt template', value="style_filewords.txt", choices=get_textual_inversion_template_names())
create_refresh_button(ti_template, textual_inversion.list_textual_inversion_templates, lambda: {"choices": get_textual_inversion_template_names()}, "refrsh_train_template_file")
ti_shuffle = gr.Checkbox(label="Shuffle tags", value=False)
@@ -201,7 +200,7 @@ def create_ui():
with gr.Box():
gr.HTML('Training outputs
')
- with FormRow():
+ with gr.Row():
ti_create_every = gr.Number(label='Create interim images', value=500, precision=0)
ti_save_every = gr.Number(label='Create interim embeddings', value=500, precision=0)
ti_save_image_with_stored_embedding = gr.Checkbox(label='Save images with embedding in PNG chunks', value=True)
@@ -266,9 +265,9 @@ def create_ui():
with gr.Tab(label="Train hypernetwork", id="train_hypernetwork_tab") as tab_hn:
tab_hn.select(fn=lambda: train_tab_change('hn'), inputs=[], outputs=[action_pp, action_ti, action_hn])
gr.HTML('Select existing hypernetwork to continue training or create a new one
')
- with FormRow():
+ with gr.Row():
with gr.Column():
- with FormRow():
+ with gr.Row():
hn_name = gr.Dropdown(label='Hypernetwork', choices=sorted(shared.hypernetworks))
create_refresh_button(hn_name, shared.reload_hypernetworks, lambda: {"choices": sorted(shared.hypernetworks)}, "refresh_train_hypernetwork_name")
with gr.Column():
@@ -288,7 +287,7 @@ def create_ui():
with gr.Box():
gr.HTML('Training parameters
')
hn_learn_rate = gr.Textbox(label='Hypernetwork Learning rate', placeholder="Hypernetwork Learning rate", value="0.00001")
- with FormRow():
+ with gr.Row():
hn_clip_grad_mode = gr.Dropdown(value="disabled", label="Gradient Clipping", choices=["disabled", "value", "norm"])
hn_clip_grad_value = gr.Number(label="Gradient clip value", value=0.1)
hn_batch_size = gr.Number(label='Batch size', value=1, precision=0)
@@ -298,7 +297,7 @@ def create_ui():
with gr.Box():
gr.HTML('Training images
')
hn_dataset_directory = gr.Textbox(label='Dataset directory', placeholder="Path to directory with input images")
- with FormRow():
+ with gr.Row():
hn_varsize = gr.Checkbox(label="Do not resize images", value=False)
hn_width = gr.Slider(minimum=64, maximum=2048, step=8, label="Width", value=512)
hn_height = gr.Slider(minimum=64, maximum=2048, step=8, label="Height", value=512)
@@ -306,7 +305,7 @@ def create_ui():
with gr.Box():
gr.HTML('Dataset processing
')
- with FormRow():
+ with gr.Row():
hn_template = gr.Dropdown(label='Prompt template', value="style_filewords.txt", choices=get_textual_inversion_template_names())
create_refresh_button(hn_template, textual_inversion.list_textual_inversion_templates, lambda: {"choices": get_textual_inversion_template_names()}, "refrsh_train_template_file")
hn_shuffle_tags = gr.Checkbox(label="Shuffle tags by ',' when creating prompts.", value=False)
@@ -315,7 +314,7 @@ def create_ui():
with gr.Box():
gr.HTML('Training outputs
')
- with FormRow():
+ with gr.Row():
hn_create_every = gr.Number(label='Create interim images', value=500, precision=0)
hn_save_every = gr.Number(label='Create interim hypernetworks', value=500, precision=0)
hn_preview_from_txt2img = gr.Checkbox(label='Use current settings for previews', value=False)
diff --git a/modules/ui_txt2img.py b/modules/ui_txt2img.py
index e2d3e3a66..38177a451 100644
--- a/modules/ui_txt2img.py
+++ b/modules/ui_txt2img.py
@@ -1,7 +1,7 @@
import gradio as gr
from modules.call_queue import wrap_gradio_gpu_call, wrap_queued_call
from modules import timer, shared, ui_common, ui_symbols, ui_sections, generation_parameters_copypaste
-from modules.ui_components import FormRow, FormGroup, ToolButton
+from modules.ui_components import ToolButton
def calc_resolution_hires(width, height, hr_scale, hr_resize_x, hr_resize_y, hr_upscaler):
@@ -26,7 +26,7 @@ def create_ui():
txt_prompt_img = gr.File(label="", elem_id="txt2img_prompt_image", file_count="single", type="binary", visible=False)
txt_prompt_img.change(fn=modules.images.image_data, inputs=[txt_prompt_img], outputs=[txt2img_prompt, txt_prompt_img])
- with FormRow(variant='compact', elem_id="txt2img_extra_networks", visible=False) as extra_networks_ui:
+ with gr.Row(variant='compact', elem_id="txt2img_extra_networks", visible=False) as extra_networks_ui:
from modules import ui_extra_networks
extra_networks_ui = ui_extra_networks.create_ui(extra_networks_ui, txt2img_extra_networks_button, 'txt2img', skip_indexing=shared.opts.extra_network_skip_indexing)
timer.startup.record('ui-en')
@@ -34,13 +34,13 @@ def create_ui():
with gr.Row(elem_id="txt2img_interface", equal_height=False):
with gr.Column(variant='compact', elem_id="txt2img_settings"):
- with FormRow():
+ with gr.Row():
width = gr.Slider(minimum=64, maximum=4096, step=8, label="Width", value=512, elem_id="txt2img_width")
height = gr.Slider(minimum=64, maximum=4096, step=8, label="Height", value=512, elem_id="txt2img_height")
res_switch_btn = ToolButton(value=ui_symbols.switch, elem_id="txt2img_res_switch_btn", label="Switch dims")
res_switch_btn.click(lambda w, h: (h, w), inputs=[width, height], outputs=[width, height], show_progress=False)
- with FormGroup(elem_classes="settings-accordion"):
+ with gr.Group(elem_classes="settings-accordion"):
steps, sampler_index = ui_sections.create_sampler_inputs('txt2img')
batch_count, batch_size = ui_sections.create_batch_inputs('txt2img')
diff --git a/scripts/postprocessing_codeformer.py b/scripts/postprocessing_codeformer.py
index ef8200276..3e5fd451d 100644
--- a/scripts/postprocessing_codeformer.py
+++ b/scripts/postprocessing_codeformer.py
@@ -3,7 +3,6 @@ import numpy as np
import gradio as gr
from modules import scripts_postprocessing
from modules.postprocess import codeformer_model
-from modules.ui_components import FormRow
class ScriptPostprocessingCodeFormer(scripts_postprocessing.ScriptPostprocessing):
@@ -11,7 +10,7 @@ class ScriptPostprocessingCodeFormer(scripts_postprocessing.ScriptPostprocessing
order = 3000
def ui(self):
- with FormRow():
+ with gr.Row():
codeformer_visibility = gr.Slider(minimum=0.0, maximum=1.0, step=0.01, label="Strength", value=0.0, elem_id="extras_codeformer_visibility")
codeformer_weight = gr.Slider(minimum=0.0, maximum=1.0, step=0.01, label="Weight", value=0.2, elem_id="extras_codeformer_weight")
return { "codeformer_visibility": codeformer_visibility, "codeformer_weight": codeformer_weight }
diff --git a/scripts/postprocessing_gfpgan.py b/scripts/postprocessing_gfpgan.py
index f78b186d3..a20e3542a 100644
--- a/scripts/postprocessing_gfpgan.py
+++ b/scripts/postprocessing_gfpgan.py
@@ -3,7 +3,6 @@ import numpy as np
import gradio as gr
from modules import scripts_postprocessing
from modules.postprocess import gfpgan_model
-from modules.ui_components import FormRow
class ScriptPostprocessingGfpGan(scripts_postprocessing.ScriptPostprocessing):
@@ -11,7 +10,7 @@ class ScriptPostprocessingGfpGan(scripts_postprocessing.ScriptPostprocessing):
order = 2000
def ui(self):
- with FormRow():
+ with gr.Row():
gfpgan_visibility = gr.Slider(minimum=0.0, maximum=1.0, step=0.001, label="Strength", value=0, elem_id="extras_gfpgan_visibility")
return { "gfpgan_visibility": gfpgan_visibility }
diff --git a/scripts/postprocessing_upscale.py b/scripts/postprocessing_upscale.py
index e97ac9b45..6f1783361 100644
--- a/scripts/postprocessing_upscale.py
+++ b/scripts/postprocessing_upscale.py
@@ -1,7 +1,7 @@
from PIL import Image
import gradio as gr
from modules import scripts_postprocessing, shared
-from modules.ui_components import FormRow, ToolButton
+from modules.ui_components import ToolButton
import modules.ui_symbols as symbols
@@ -13,23 +13,23 @@ class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing):
selected_tab = gr.State(value=0) # pylint: disable=abstract-class-instantiated
with gr.Column():
- with FormRow(elem_id="extras_upscale"):
+ with gr.Row(elem_id="extras_upscale"):
with gr.Tabs(elem_id="extras_resize_mode"):
with gr.TabItem('Scale by', elem_id="extras_scale_by_tab") as tab_scale_by:
upscaling_resize = gr.Slider(minimum=1.0, maximum=8.0, step=0.05, label="Resize", value=2.0, elem_id="extras_upscaling_resize")
with gr.TabItem('Scale to', elem_id="extras_scale_to_tab") as tab_scale_to:
- with FormRow():
+ with gr.Row():
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")
upscaling_crop = gr.Checkbox(label='Crop to fit', value=True, elem_id="extras_upscaling_crop")
- with FormRow():
+ with gr.Row():
extras_upscaler_1 = gr.Dropdown(label='Upscaler', elem_id="extras_upscaler_1", choices=[x.name for x in shared.sd_upscalers], value=shared.sd_upscalers[0].name)
- with FormRow():
+ with gr.Row():
extras_upscaler_2 = gr.Dropdown(label='Secondary Upscaler', elem_id="extras_upscaler_2", choices=[x.name for x in shared.sd_upscalers], value=shared.sd_upscalers[0].name)
extras_upscaler_2_visibility = gr.Slider(minimum=0.0, maximum=1.0, step=0.001, label="Upscaler 2 visibility", value=0.0, elem_id="extras_upscaler_2_visibility")
@@ -95,7 +95,7 @@ class ScriptPostprocessingUpscaleSimple(ScriptPostprocessingUpscale):
order = 900
def ui(self):
- with FormRow():
+ with gr.Row():
upscaler_name = gr.Dropdown(label='Upscaler', choices=[x.name for x in shared.sd_upscalers], value=shared.sd_upscalers[0].name)
upscale_by = gr.Slider(minimum=0.05, maximum=8.0, step=0.05, label="Upscale by", value=2)
return {