Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bing-su committed Jan 10, 2024
2 parents 9269219 + 8298a32 commit ebd69df
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
rev: v0.1.11
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 2024-01-10

- v24.1.1
- SDNext 호환 업데이트 (issue #466)
- 설정 값 state에 초기값 추가
- 위젯 값을 변경할 때마다 state도 변경되게 함 (기존에는 생성 버튼을 누를 때 적용되었음)
- `inpaint_depth_hand` 컨트롤넷 모델이 depth 모델로 인식되게 함 (issue #463)

## 2024-01-04

- v24.1.0
Expand Down
2 changes: 1 addition & 1 deletion adetailer/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "24.1.0"
__version__ = "24.1.1"
16 changes: 15 additions & 1 deletion adetailer/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def suffix(n: int, c: str = " ") -> str:


def on_widget_change(state: dict, value: Any, *, attr: str):
if "is_api" in state:
state = state.copy()
state.pop("is_api")
state[attr] = value
return state

Expand All @@ -71,6 +74,7 @@ def on_generate_click(state: dict, *values: Any):


def on_cn_model_update(cn_model_name: str):
cn_model_name = cn_model_name.replace("inpaint_depth", "depth")
for t in cn_module_choices:
if t in cn_model_name:
choices = cn_module_choices[t]
Expand All @@ -84,6 +88,10 @@ def elem_id(item_id: str, n: int, is_img2img: bool) -> str:
return f"script_{tap}_adetailer_{item_id}{suf}"


def state_init(w: Widgets) -> dict[str, Any]:
return {attr: getattr(w, attr).value for attr in ALL_ARGS.attrs}


def adui(
num_models: int,
is_img2img: bool,
Expand Down Expand Up @@ -139,7 +147,6 @@ def adui(

def one_ui_group(n: int, is_img2img: bool, webui_info: WebuiInfo):
w = Widgets()
state = gr.State({})
eid = partial(elem_id, n=n, is_img2img=is_img2img)

with gr.Row():
Expand Down Expand Up @@ -202,6 +209,13 @@ def one_ui_group(n: int, is_img2img: bool, webui_info: WebuiInfo):
with gr.Group():
controlnet(w, n, is_img2img)

state = gr.State(lambda: state_init(w))

for attr in ALL_ARGS.attrs:
widget = getattr(w, attr)
on_change = partial(on_widget_change, attr=attr)
widget.change(fn=on_change, inputs=[state, widget], outputs=state, queue=False)

all_inputs = [state, *w.tolist()]
target_button = webui_info.i2i_button if is_img2img else webui_info.t2i_button
target_button.click(
Expand Down
2 changes: 1 addition & 1 deletion install.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def run_pip(*args):
def install():
deps = [
# requirements
("ultralytics", "8.0.229", None),
("ultralytics", "8.1.0", None),
("mediapipe", "0.10.9", None),
("rich", "13.0.0", None),
# mediapipe
Expand Down

0 comments on commit ebd69df

Please sign in to comment.