Skip to content

Commit

Permalink
feat: add ad-save-images
Browse files Browse the repository at this point in the history
  • Loading branch information
bluelovers committed Aug 18, 2024
1 parent 64ea03e commit c4c0119
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions scripts/!adetailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit c4c0119

Please sign in to comment.