From bbd224c9f096b4a01a0daecfdf8b80c853d00f7c Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 17 Nov 2024 07:58:21 -0500 Subject: [PATCH] fix xyz grid with scripts/detailer Signed-off-by: Vladimir Mandic --- modules/postprocess/yolo.py | 1 - scripts/xyz_grid_on.py | 14 +++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/postprocess/yolo.py b/modules/postprocess/yolo.py index 920e126e2..f42b6bb9f 100644 --- a/modules/postprocess/yolo.py +++ b/modules/postprocess/yolo.py @@ -202,7 +202,6 @@ class YoloRestorer(Detailer): shared.log.info(f'Detailer: model="{name}" no items detected') continue - pp = None shared.opts.data['mask_apply_overlay'] = True resolution = 512 if shared.sd_model_type in ['none', 'sd', 'lcm', 'unknown'] else 1024 orig_prompt: str = orig_p.get('all_prompts', [''])[0] diff --git a/scripts/xyz_grid_on.py b/scripts/xyz_grid_on.py index f0455f0f1..202a2cfc4 100644 --- a/scripts/xyz_grid_on.py +++ b/scripts/xyz_grid_on.py @@ -419,6 +419,14 @@ class Script(scripts.Script): def process_images(self, p, *args): # pylint: disable=W0221, W0613 - if p.iteration > 0 and cache is not None and len(cache.images) > 0: - cache.images = [] # avoid returning same images multiple items - return cache + if hasattr(cache, 'used'): + cache.images.clear() + cache.used = False + elif cache is not None and len(cache.images) > 0: + cache.used = True + p.restore_faces = False + p.detailer = False + p.color_corrections = None + p.scripts = None + return cache + return None