mirror of
https://github.com/Bing-su/adetailer.git
synced 2026-01-26 11:19:53 +00:00
style: apply pre-commit
This commit is contained in:
@@ -54,7 +54,9 @@ class ADetailerArgs(BaseModel, extra=Extra.forbid):
|
||||
ad_use_cfg_scale: bool = False
|
||||
ad_cfg_scale: NonNegativeFloat = 7.0
|
||||
ad_restore_face: bool = False
|
||||
ad_controlnet_model: constr(regex=r".*(inpaint|tile|scribble|lineart|openpose).*|^None$") = "None"
|
||||
ad_controlnet_model: constr(
|
||||
regex=r".*(inpaint|tile|scribble|lineart|openpose).*|^None$"
|
||||
) = "None"
|
||||
ad_controlnet_weight: confloat(ge=0.0, le=1.0) = 1.0
|
||||
ad_controlnet_guidance_end: confloat(ge=0.0, le=1.0) = 1.0
|
||||
|
||||
@@ -108,7 +110,11 @@ class ADetailerArgs(BaseModel, extra=Extra.forbid):
|
||||
ppop("ADetailer restore face")
|
||||
ppop(
|
||||
"ADetailer ControlNet model",
|
||||
["ADetailer ControlNet model", "ADetailer ControlNet weight", "ADetailer ControlNet guidance end"],
|
||||
[
|
||||
"ADetailer ControlNet model",
|
||||
"ADetailer ControlNet weight",
|
||||
"ADetailer ControlNet guidance end",
|
||||
],
|
||||
cond="None",
|
||||
)
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ def one_ui_group(
|
||||
interactive=controlnet_exists,
|
||||
elem_id=eid("ad_controlnet_weight"),
|
||||
)
|
||||
|
||||
|
||||
w.ad_controlnet_guidance_end = gr.Slider(
|
||||
label="ControlNet guidance end" + suffix(n),
|
||||
minimum=0.0,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import re
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
import re
|
||||
|
||||
from modules import sd_models, shared
|
||||
from modules.paths import data_path, models_path, script_path
|
||||
@@ -13,13 +13,15 @@ ext_builtin_path = Path(script_path, "extensions-builtin")
|
||||
is_in_builtin = False # compatibility for vladmandic/automatic
|
||||
controlnet_exists = False
|
||||
controlnet_enabled_models = {
|
||||
'inpaint': 'inpaint_global_harmonious',
|
||||
'scribble': 't2ia_sketch_pidi',
|
||||
'lineart': 'lineart_coarse',
|
||||
'openpose': 'openpose_full',
|
||||
'tile': None,
|
||||
"inpaint": "inpaint_global_harmonious",
|
||||
"scribble": "t2ia_sketch_pidi",
|
||||
"lineart": "lineart_coarse",
|
||||
"openpose": "openpose_full",
|
||||
"tile": None,
|
||||
}
|
||||
controlnet_model_regex = re.compile(r'.*('+('|'.join(controlnet_enabled_models.keys()))+').*')
|
||||
controlnet_model_regex = re.compile(
|
||||
r".*(" + ("|".join(controlnet_enabled_models.keys())) + ").*"
|
||||
)
|
||||
|
||||
if ext_path.exists():
|
||||
controlnet_exists = any(
|
||||
@@ -114,7 +116,11 @@ def _get_cn_inpaint_models() -> list[str]:
|
||||
continue
|
||||
|
||||
for p in base.rglob("*"):
|
||||
if p.is_file() and p.suffix in cn_model_exts and controlnet_model_regex.match(p.name):
|
||||
if (
|
||||
p.is_file()
|
||||
and p.suffix in cn_model_exts
|
||||
and controlnet_model_regex.match(p.name)
|
||||
):
|
||||
if name_filter and name_filter not in p.name.lower():
|
||||
continue
|
||||
model_paths.append(p)
|
||||
|
||||
@@ -138,7 +138,10 @@ class AfterDetailerScript(scripts.Script):
|
||||
and args.ad_controlnet_model != "None"
|
||||
):
|
||||
self.controlnet_ext.update_scripts_args(
|
||||
p, args.ad_controlnet_model, args.ad_controlnet_weight, args.ad_controlnet_guidance_end
|
||||
p,
|
||||
args.ad_controlnet_model,
|
||||
args.ad_controlnet_weight,
|
||||
args.ad_controlnet_guidance_end,
|
||||
)
|
||||
|
||||
def is_ad_enabled(self, *args_) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user