From 9be63719898e326ec172e9311aaeafdd52d0c2d1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 17 Sep 2024 04:22:33 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- aaaaaa/ui.py | 6 +++++- scripts/!adetailer.py | 26 ++++++++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/aaaaaa/ui.py b/aaaaaa/ui.py index 6763caa..044baf1 100644 --- a/aaaaaa/ui.py +++ b/aaaaaa/ui.py @@ -712,4 +712,8 @@ def controlnet(w: Widgets, n: int, is_img2img: bool): ) with gr.Column(variant="compact"): - w.ad_solo_generation = gr.Checkbox(label="Solo generation" + suffix(n), value=False, elem_id=eid("ad_solo_generation")) + w.ad_solo_generation = gr.Checkbox( + label="Solo generation" + suffix(n), + value=False, + elem_id=eid("ad_solo_generation"), + ) diff --git a/scripts/!adetailer.py b/scripts/!adetailer.py index 6a49e35..714fdfb 100644 --- a/scripts/!adetailer.py +++ b/scripts/!adetailer.py @@ -918,7 +918,7 @@ def postprocess_image(self, p, pp: PPImage, *args_): is_processed |= self._postprocess_image_inner(p, pp, args, n=n) if n < last_index: - save_incrementals.append((n,copy(pp.image))) + save_incrementals.append((n, copy(pp.image))) for n, args in enumerate(arg_list): if args.need_skip() or args.ad_solo_generation is False: @@ -931,7 +931,10 @@ def postprocess_image(self, p, pp: PPImage, *args_): if is_processed: if not is_skip_img2img(p): self.save_image( - p, init_image, condition="ad_save_images_before", suffix="-ad-before" + p, + init_image, + condition="ad_save_images_before", + suffix="-ad-before", ) for save in save_incrementals: @@ -944,7 +947,9 @@ def postprocess_image(self, p, pp: PPImage, *args_): all_extra_params = p.extra_generation_params for save in save_solos: - p.extra_generation_params = self.fix_extra_generation_params(all_extra_params, save[2]) + p.extra_generation_params = self.fix_extra_generation_params( + all_extra_params, save[2] + ) self.save_image( p, save[1], @@ -961,24 +966,25 @@ def postprocess_image(self, p, pp: PPImage, *args_): self.write_params_txt(params_txt_content) - def fix_extra_generation_params(self, params:dict, args:ADetailerArgs): + def fix_extra_generation_params(self, params: dict, args: ADetailerArgs): ad_params = {} for params_k in list(params.keys()): found = False - for i, (k,v) in enumerate (_all_args): + for i, (k, v) in enumerate(_all_args): if v in params_k: found = True break if not found: ad_params[params_k] = params[params_k] - for i, (k,v) in enumerate (_all_args): - if hasattr(args,k): - args_v = getattr(args,k) - if args_v is not None and args_v != '': + for i, (k, v) in enumerate(_all_args): + if hasattr(args, k): + args_v = getattr(args, k) + if args_v is not None and args_v != "": ad_params[v] = args_v return ad_params - + + def on_after_component(component, **_kwargs): global txt2img_submit_button, img2img_submit_button if getattr(component, "elem_id", None) == "txt2img_generate":