shared.options_templates.update(shared.options_section(('settings_in_ui',"Settings in UI","ui"),{
"extra_options_txt2img":shared.OptionInfo([],"Options in main UI - txt2img",ui_components.DropdownMulti,lambda:{"choices":list(shared.opts.data_labels.keys())}).js("info","settingsHintsShowQuicksettings").info("setting entries that also appear in txt2img interfaces").needs_reload_ui(),
"settings_in_ui":shared.OptionHTML("""
"extra_options_img2img":shared.OptionInfo([],"Options in main UI - img2img",ui_components.DropdownMulti,lambda:{"choices":list(shared.opts.data_labels.keys())}).js("info","settingsHintsShowQuicksettings").info("setting entries that also appear in img2img interfaces").needs_reload_ui(),
This page allows you to add some settings to the main interface of txt2img and img2img tabs.
"extra_options_cols":shared.OptionInfo(1,"Options in main UI - number of columns",gr.Number,{"precision":0}).needs_reload_ui(),
"""),
"extra_options_accordion":shared.OptionInfo(False,"Options in main UI - place into an accordion").needs_reload_ui()
"extra_options_txt2img":shared.OptionInfo([],"Settings for txt2img",ui_components.DropdownMulti,lambda:{"choices":list(shared.opts.data_labels.keys())}).js("info","settingsHintsShowQuicksettings").info("setting entries that also appear in txt2img interfaces").needs_reload_ui(),
"extra_options_img2img":shared.OptionInfo([],"Settings for img2img",ui_components.DropdownMulti,lambda:{"choices":list(shared.opts.data_labels.keys())}).js("info","settingsHintsShowQuicksettings").info("setting entries that also appear in img2img interfaces").needs_reload_ui(),
"extra_options_cols":shared.OptionInfo(1,"Number of columns for added settings",gr.Number,{"precision":0}).needs_reload_ui(),
"extra_options_accordion":shared.OptionInfo(False,"Place added settings into an accordion").needs_reload_ui()
Returns a function that applies the given value to the given value_name in opts.data.
"""
defvalidate(value_name:str,value:str):
value=int(value)
# validate value
ifnotmin_range==-1:
assertvalue>=min_range,f"Value {value} for {value_name} must be greater than or equal to {min_range}"
ifnotmax_range==-1:
assertvalue<=max_range,f"Value {value} for {value_name} must be less than or equal to {max_range}"
defapply_int(p,x,xs):
validate(value_name,x)
opts.data[value_name]=int(x)
returnapply_int
defbool_applier(value_name:str):
"""
Returns a function that applies the given value to the given value_name in opts.data.
"""
defvalidate(value_name:str,value:str):
assertvalue.lower()in["true","false"],f"Value {value} for {value_name} must be either true or false"
defapply_bool(p,x,xs):
validate(value_name,x)
value_boolean=x.lower()=="true"
opts.data[value_name]=value_boolean
returnapply_bool
defadd_axis_options():
extra_axis_options=[
xyz_grid.AxisOption("[Hypertile] Unet First pass Enabled",str,bool_applier("hypertile_enable_unet"),choices=xyz_grid.boolean_choice(reverse=True)),
xyz_grid.AxisOption("[Hypertile] Unet Second pass Enabled",str,bool_applier("hypertile_enable_unet_secondpass"),choices=xyz_grid.boolean_choice(reverse=True)),
xyz_grid.AxisOption("[Hypertile] Unet Max Depth",int,int_applier("hypertile_max_depth_unet",0,3),choices=lambda:[str(x)forxinrange(4)]),
xyz_grid.AxisOption("[Hypertile] Unet Max Tile Size",int,int_applier("hypertile_max_tile_unet",0,512)),