|
@@ -199,8 +199,9 @@ interrogator = modules.interrogate.InterrogateModels("interrogate")
|
|
|
|
|
|
face_restorers = []
|
|
|
|
|
|
+
|
|
|
class OptionInfo:
|
|
|
- def __init__(self, default=None, label="", component=None, component_args=None, onchange=None, section=None, refresh=None):
|
|
|
+ def __init__(self, default=None, label="", component=None, component_args=None, onchange=None, section=None, refresh=None, comment_before='', comment_after=''):
|
|
|
self.default = default
|
|
|
self.label = label
|
|
|
self.component = component
|
|
@@ -209,6 +210,24 @@ class OptionInfo:
|
|
|
self.section = section
|
|
|
self.refresh = refresh
|
|
|
|
|
|
+ self.comment_before = comment_before
|
|
|
+ """HTML text that will be added after label in UI"""
|
|
|
+
|
|
|
+ self.comment_after = comment_after
|
|
|
+ """HTML text that will be added before label in UI"""
|
|
|
+
|
|
|
+ def link(self, label, url):
|
|
|
+ self.comment_before += f"[<a href='{url}' target='_blank'>{label}</a>]"
|
|
|
+ return self
|
|
|
+
|
|
|
+ def js(self, label, js_func):
|
|
|
+ self.comment_before += f"[<a onclick='{js_func}(); return false'>{label}</a>]"
|
|
|
+ return self
|
|
|
+
|
|
|
+ def info(self, info):
|
|
|
+ self.comment_after += f"<span class='info'>({info})</span>"
|
|
|
+ return self
|
|
|
+
|
|
|
|
|
|
def options_section(section_identifier, options_dict):
|
|
|
for v in options_dict.values():
|
|
@@ -240,7 +259,7 @@ options_templates = {}
|
|
|
options_templates.update(options_section(('saving-images', "Saving images/grids"), {
|
|
|
"samples_save": OptionInfo(True, "Always save all generated images"),
|
|
|
"samples_format": OptionInfo('png', 'File format for images'),
|
|
|
- "samples_filename_pattern": OptionInfo("", "Images filename pattern", component_args=hide_dirs),
|
|
|
+ "samples_filename_pattern": OptionInfo("", "Images filename pattern", component_args=hide_dirs).link("wiki", "https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Custom-Images-Filename-Name-and-Subdirectory"),
|
|
|
"save_images_add_number": OptionInfo(True, "Add number to filename when saving", component_args=hide_dirs),
|
|
|
|
|
|
"grid_save": OptionInfo(True, "Always save all generated image grids"),
|
|
@@ -290,7 +309,7 @@ options_templates.update(options_section(('saving-to-dirs', "Saving to a directo
|
|
|
"save_to_dirs": OptionInfo(True, "Save images to a subdirectory"),
|
|
|
"grid_save_to_dirs": OptionInfo(True, "Save grids to a subdirectory"),
|
|
|
"use_save_to_dirs_for_ui": OptionInfo(False, "When using \"Save\" button, save images to a subdirectory"),
|
|
|
- "directories_filename_pattern": OptionInfo("[date]", "Directory name pattern", component_args=hide_dirs),
|
|
|
+ "directories_filename_pattern": OptionInfo("[date]", "Directory name pattern", component_args=hide_dirs).link("wiki", "https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Custom-Images-Filename-Name-and-Subdirectory"),
|
|
|
"directories_max_prompt_words": OptionInfo(8, "Max prompt words for [prompt_words] pattern", gr.Slider, {"minimum": 1, "maximum": 20, "step": 1, **hide_dirs}),
|
|
|
}))
|
|
|
|
|
@@ -350,7 +369,7 @@ options_templates.update(options_section(('sd', "Stable Diffusion"), {
|
|
|
"CLIP_stop_at_last_layers": OptionInfo(1, "Clip skip", gr.Slider, {"minimum": 1, "maximum": 12, "step": 1}),
|
|
|
"upcast_attn": OptionInfo(False, "Upcast cross attention layer to float32"),
|
|
|
"randn_source": OptionInfo("GPU", "Random number generator source. Changes seeds drastically. Use CPU to produce the same picture across different vidocard vendors.", gr.Radio, {"choices": ["GPU", "CPU"]}),
|
|
|
- "token_merging_ratio": OptionInfo(0.0, "Token merging ratio", gr.Slider, {"minimum": 0.0, "maximum": 0.9, "step": 0.1}),
|
|
|
+ "token_merging_ratio": OptionInfo(0.0, "Token merging ratio", gr.Slider, {"minimum": 0.0, "maximum": 0.9, "step": 0.1}).link("PR", "https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9256").info("0=disable, higher=faster"),
|
|
|
"token_merging_ratio_hr": OptionInfo(0.0, "Togen merging ratio for high-res pass", gr.Slider, {"minimum": 0.0, "maximum": 0.9, "step": 0.1}),
|
|
|
}))
|
|
|
|
|
@@ -404,7 +423,7 @@ options_templates.update(options_section(('ui', "User interface"), {
|
|
|
"keyedit_precision_attention": OptionInfo(0.1, "Ctrl+up/down precision when editing (attention:1.1)", gr.Slider, {"minimum": 0.01, "maximum": 0.2, "step": 0.001}),
|
|
|
"keyedit_precision_extra": OptionInfo(0.05, "Ctrl+up/down precision when editing <extra networks:0.9>", gr.Slider, {"minimum": 0.01, "maximum": 0.2, "step": 0.001}),
|
|
|
"keyedit_delimiters": OptionInfo(".,\\/!?%^*;:{}=`~()", "Ctrl+up/down word delimiters"),
|
|
|
- "quicksettings_list": OptionInfo(["sd_model_checkpoint"], "Quicksettings list", ui_components.DropdownMulti, lambda: {"choices": list(opts.data_labels.keys())}),
|
|
|
+ "quicksettings_list": OptionInfo(["sd_model_checkpoint"], "Quicksettings list", ui_components.DropdownMulti, lambda: {"choices": list(opts.data_labels.keys())}).js("info", "settingsHintsShowQuicksettings"),
|
|
|
"hidden_tabs": OptionInfo([], "Hidden UI tabs (requires restart)", ui_components.DropdownMulti, lambda: {"choices": list(tab_names)}),
|
|
|
"ui_reorder": OptionInfo(", ".join(ui_reorder_categories), "txt2img/img2img UI item order"),
|
|
|
"ui_extra_networks_tab_reorder": OptionInfo("", "Extra networks tab order"),
|
|
@@ -572,7 +591,9 @@ class Options:
|
|
|
func()
|
|
|
|
|
|
def dumpjson(self):
|
|
|
- d = {k: self.data.get(k, self.data_labels.get(k).default) for k in self.data_labels.keys()}
|
|
|
+ d = {k: self.data.get(k, v.default) for k, v in self.data_labels.items()}
|
|
|
+ d["_comments_before"] = {k: v.comment_before for k, v in self.data_labels.items() if v.comment_before is not None}
|
|
|
+ d["_comments_after"] = {k: v.comment_after for k, v in self.data_labels.items() if v.comment_after is not None}
|
|
|
return json.dumps(d)
|
|
|
|
|
|
def add_option(self, key, info):
|