mirror of
https://github.com/Bing-su/adetailer.git
synced 2026-01-26 19:29:54 +00:00
style: apply new rules
This commit is contained in:
@@ -1 +1 @@
|
|||||||
__version__ = "23.6.2"
|
__version__ = "23.6.3.dev0"
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ def mediapipe_predict(
|
|||||||
if model_type in mapping:
|
if model_type in mapping:
|
||||||
func = mapping[model_type]
|
func = mapping[model_type]
|
||||||
return func(image, confidence)
|
return func(image, confidence)
|
||||||
raise RuntimeError(f"[-] ADetailer: Invalid mediapipe model type: {model_type}")
|
msg = f"[-] ADetailer: Invalid mediapipe model type: {model_type}"
|
||||||
|
raise RuntimeError(msg)
|
||||||
|
|
||||||
|
|
||||||
def mediapipe_face_detection(
|
def mediapipe_face_detection(
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ def adui(
|
|||||||
infotext_fields.extend(infofields)
|
infotext_fields.extend(infofields)
|
||||||
|
|
||||||
# components: [bool, dict, dict, ...]
|
# components: [bool, dict, dict, ...]
|
||||||
components = [ad_enable] + states
|
components = [ad_enable, *states]
|
||||||
return components, infotext_fields
|
return components, infotext_fields
|
||||||
|
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ def one_ui_group(
|
|||||||
eid = partial(elem_id, n=n, is_img2img=is_img2img)
|
eid = partial(elem_id, n=n, is_img2img=is_img2img)
|
||||||
|
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
model_choices = model_list + ["None"] if n == 0 else ["None"] + model_list
|
model_choices = [*model_list, "None"] if n == 0 else ["None", *model_list]
|
||||||
|
|
||||||
w.ad_model = gr.Dropdown(
|
w.ad_model = gr.Dropdown(
|
||||||
label="ADetailer model" + suffix(n),
|
label="ADetailer model" + suffix(n),
|
||||||
@@ -164,7 +164,7 @@ def one_ui_group(
|
|||||||
fn=on_change, inputs=[state, widget], outputs=[state], queue=False
|
fn=on_change, inputs=[state, widget], outputs=[state], queue=False
|
||||||
)
|
)
|
||||||
|
|
||||||
all_inputs = [state] + w.tolist()
|
all_inputs = [state, *w.tolist()]
|
||||||
target_button = i2i_button if is_img2img else t2i_button
|
target_button = i2i_button if is_img2img else t2i_button
|
||||||
target_button.click(
|
target_button.click(
|
||||||
fn=on_generate_click, inputs=all_inputs, outputs=state, queue=False
|
fn=on_generate_click, inputs=all_inputs, outputs=state, queue=False
|
||||||
@@ -402,7 +402,7 @@ def inpainting(w: Widgets, n: int, is_img2img: bool):
|
|||||||
|
|
||||||
def controlnet(w: Widgets, n: int, is_img2img: bool):
|
def controlnet(w: Widgets, n: int, is_img2img: bool):
|
||||||
eid = partial(elem_id, n=n, is_img2img=is_img2img)
|
eid = partial(elem_id, n=n, is_img2img=is_img2img)
|
||||||
cn_models = ["None"] + get_cn_models()
|
cn_models = ["None", *get_cn_models()]
|
||||||
|
|
||||||
with gr.Row(variant="panel"):
|
with gr.Row(variant="panel"):
|
||||||
with gr.Column(variant="compact"):
|
with gr.Column(variant="compact"):
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ profile = "black"
|
|||||||
known_first_party = ["launch", "modules"]
|
known_first_party = ["launch", "modules"]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
select = ["A", "B", "C4", "C90", "COM", "E", "EM", "F", "FA", "I001", "ISC", "N", "PIE", "PT", "RET", "RUF", "SIM", "UP", "W"]
|
select = ["A", "B", "C4", "C90", "E", "EM", "F", "FA", "I001", "ISC", "N", "PIE", "PT", "RET", "RUF", "SIM", "UP", "W"]
|
||||||
ignore = ["B008", "B905", "E501", "F401", "UP007"]
|
ignore = ["B008", "B905", "E501", "F401", "UP007"]
|
||||||
|
|
||||||
[tool.ruff.isort]
|
[tool.ruff.isort]
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from typing import Any
|
|||||||
import gradio as gr
|
import gradio as gr
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
import modules # noqa: F401
|
import modules
|
||||||
from adetailer import (
|
from adetailer import (
|
||||||
AFTER_DETAILER,
|
AFTER_DETAILER,
|
||||||
__version__,
|
__version__,
|
||||||
@@ -647,7 +647,7 @@ def make_axis_on_xyz_grid():
|
|||||||
if xyz_grid is None:
|
if xyz_grid is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
model_list = ["None"] + list(model_mapping.keys())
|
model_list = ["None", *model_mapping.keys()]
|
||||||
|
|
||||||
def set_value(p, x, xs, *, field: str):
|
def set_value(p, x, xs, *, field: str):
|
||||||
if not hasattr(p, "adetailer_xyz"):
|
if not hasattr(p, "adetailer_xyz"):
|
||||||
@@ -696,7 +696,7 @@ def make_axis_on_xyz_grid():
|
|||||||
"[ADetailer] ControlNet model 1st",
|
"[ADetailer] ControlNet model 1st",
|
||||||
str,
|
str,
|
||||||
partial(set_value, field="ad_controlnet_model"),
|
partial(set_value, field="ad_controlnet_model"),
|
||||||
choices=lambda: ["None"] + get_cn_models(),
|
choices=lambda: ["None", *get_cn_models()],
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user