diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dbea90d..56f7366 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/CHANGELOG.md b/CHANGELOG.md index e872f6d..1513491 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/adetailer/__version__.py b/adetailer/__version__.py index 22026e5..9696595 100644 --- a/adetailer/__version__.py +++ b/adetailer/__version__.py @@ -1 +1 @@ -__version__ = "24.1.0" +__version__ = "24.1.1" diff --git a/adetailer/ui.py b/adetailer/ui.py index fa28262..9733aed 100644 --- a/adetailer/ui.py +++ b/adetailer/ui.py @@ -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 @@ -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] @@ -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, @@ -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(): @@ -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( diff --git a/install.py b/install.py index 2c9e068..cc7325d 100644 --- a/install.py +++ b/install.py @@ -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