diff --git a/adetailer/ui.py b/adetailer/ui.py index d512c61..9c74a42 100644 --- a/adetailer/ui.py +++ b/adetailer/ui.py @@ -11,11 +11,21 @@ from adetailer import AFTER_DETAILER, __version__ from adetailer.args import ALL_ARGS, MASK_MERGE_INVERT from controlnet_ext import controlnet_exists, get_cn_models -cn_module_choices = [ - "inpaint_global_harmonious", - "inpaint_only", - "inpaint_only+lama", -] +cn_module_choices = { + "inpaint": [ + "inpaint_global_harmonious", + "inpaint_only", + "inpaint_only+lama", + ], + "lineart": [ + "lineart_coarse", + "lineart_realistic", + "lineart_anime", + "lineart_anime_denoise", + ], + "openpose": ["openpose_full", "dw_openpose_full"], + "tile": ["tile_resample", "tile_colorfix", "tile_colorfix+sharp"], +} class Widgets(SimpleNamespace): @@ -58,11 +68,11 @@ def on_generate_click(state: dict, *values: Any): return state -def on_cn_model_update(cn_model: str): - if "inpaint" in cn_model: - return gr.update( - visible=True, choices=cn_module_choices, value=cn_module_choices[0] - ) +def on_cn_model_update(cn_model_name: str): + for t in cn_module_choices: + if t in cn_model_name: + choices = cn_module_choices[t] + return gr.update(visible=True, choices=choices, value=choices[0]) return gr.update(visible=False, choices=["None"], value="None") @@ -564,8 +574,8 @@ def controlnet(w: Widgets, n: int, is_img2img: bool): w.ad_controlnet_module = gr.Dropdown( label="ControlNet module" + suffix(n), - choices=cn_module_choices, - value="inpaint_global_harmonious", + choices=["None"], + value="None", visible=False, type="value", interactive=controlnet_exists, diff --git a/controlnet_ext/controlnet_ext.py b/controlnet_ext/controlnet_ext.py index 463885b..5a39b30 100644 --- a/controlnet_ext/controlnet_ext.py +++ b/controlnet_ext/controlnet_ext.py @@ -29,7 +29,7 @@ cn_model_module = { "scribble": "t2ia_sketch_pidi", "lineart": "lineart_coarse", "openpose": "openpose_full", - "tile": None, + "tile": "tile_resample", } cn_model_regex = re.compile("|".join(cn_model_module.keys())) @@ -60,7 +60,7 @@ class ControlNetExt: if (not self.cn_available) or model == "None": return - if module is None: + if module is None or module == "None": for m, v in cn_model_module.items(): if m in model: module = v