From c4c011908e1a286893ee5a089bfdd44769b086a3 Mon Sep 17 00:00:00 2001 From: bluelovers Date: Mon, 19 Aug 2024 00:30:57 +0800 Subject: [PATCH] feat: add `ad-save-images` https://github.com/Bing-su/adetailer/issues/688 --- scripts/!adetailer.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/!adetailer.py b/scripts/!adetailer.py index 9b0b1c8..719f731 100644 --- a/scripts/!adetailer.py +++ b/scripts/!adetailer.py @@ -8,7 +8,7 @@ from contextlib import contextmanager from copy import copy, deepcopy from functools import partial -from pathlib import Path +from pathlib import Path, PurePath from textwrap import dedent from typing import Any @@ -450,9 +450,11 @@ def save_image(self, p, image, *, condition: str, suffix: str) -> None: seed, _ = self.get_seed(p) if opts.data.get(condition, False): + ad_save_images_dir = opts.data.get("ad_save_images_dir", str(PurePath("outputs", "ad-save-images"))) + images.save_image( image=image, - path=p.outpath_samples, + path=ad_save_images_dir, basename="", seed=seed, prompt=save_prompt, @@ -689,6 +691,16 @@ def on_ui_settings(): ), ) + shared.opts.add_option( + "ad_save_images_dir", + shared.OptionInfo( + default=str(PurePath("outputs", "ad-save-images")), + label="Output directory for adetailer images", + component=gr.Textbox, + section=section, + ), + ) + shared.opts.add_option( "ad_save_previews", shared.OptionInfo(False, "Save mask previews", section=section),