diff --git a/CHANGELOG.md b/CHANGELOG.md index 0060efc3e..892055ce3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,8 @@ But also many smaller quality-of-life improvements - for full details, see [Chan - **Nunchaku** models are now listed in networks tab as reference models instead of being used implicitly via quantization - improve image **Metadata** parser for foreign metadata (e.g. XMP) + - new **CeeTeeDees image-to-image batch inference**, thanks @resonantsky + available in *main interface -> scripts* - **Compute** - **ROCm** advanced configuration and tuning, thanks @resonantsky see *main interface -> scripts -> rocm advanced config* diff --git a/pyproject.toml b/pyproject.toml index 85bd5e03b..e70e9b228 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -140,6 +140,7 @@ main.ignore-paths=[ "modules/control/proc", "modules/control/units", "modules/dml", + "modules/face", "modules/flash_attn_triton_amd", "modules/ggml", "modules/hidiffusion", diff --git a/scripts/i2i_folder.py b/scripts/i2i_folder.py index 36d84de20..905c8530f 100644 --- a/scripts/i2i_folder.py +++ b/scripts/i2i_folder.py @@ -1,12 +1,10 @@ import os import copy -from modules.files_cache import list_files import gradio as gr from PIL import Image -from modules import processing, scripts_manager, sd_samplers, images -from modules import shared -from modules.processing import Processed, get_processed -from modules.shared import state, log +from modules import shared, processing, scripts_manager, sd_samplers, images +from modules.logger import log +from modules.files_cache import list_files class Script(scripts_manager.Script): @@ -18,9 +16,8 @@ class Script(scripts_manager.Script): def ui(self, is_img2img): # pylint: disable=unused-argument with gr.Row(): - gr.HTML('
The purpose of this script is to assist in Img2Img of folders containing incrementally named images such as one would use when extracting frames from video.
It can use any model though is best done with high consistency models such as Flux.
Note the full path of your folder containing incrementally numbered images such as Frame000 to Frame900 and the script will run Inference on each image in order saving the images with identical names in an output subfolder.
') + gr.HTML('The purpose of this script is to assist in Img2Img of folders containing incrementally named images such as one would use when extracting frames from video.
It can use any model though is best done with high consistency models such as Flux.
Note the full path of your folder containing incrementally numbered images such as Frame000 to Frame900 and the script will run Inference on each image in order saving the images with identical names in an output subfolder.
') with gr.Row(): - folder = gr.Textbox( label="Input folder", placeholder="Path to folder containing png, jpg, jpeg, webp or jxl images", @@ -166,12 +163,12 @@ class Script(scripts_manager.Script): folder = (folder or "").strip() if not folder or not os.path.isdir(folder): log.error(f"Image folder batch: invalid or missing folder: {folder!r}") - return Processed(p, [], p.seed, "Invalid or missing folder") + return processing.Processed(p, [], p.seed, "Invalid or missing folder") files = sorted(list_files(folder, ext_filter=['.png', '.jpg', '.jpeg', '.webp', '.jxl'], recursive=False)) if not files: log.error(f"Image folder batch: no image files found in: {folder!r}") - return Processed(p, [], p.seed, "No image files found") + return processing.Processed(p, [], p.seed, "No image files found") out_dir = (output_dir or "").strip() or os.path.join(folder, "output") os.makedirs(out_dir, exist_ok=True) @@ -202,7 +199,7 @@ class Script(scripts_manager.Script): if negative_override.strip(): p.negative_prompt = negative_override.strip() - state.job_count = len(files) + shared.state.job_count = len(files) all_images = [] all_prompts = [] @@ -211,10 +208,10 @@ class Script(scripts_manager.Script): infotexts = [] for i, filepath in enumerate(files): - if state.interrupted: + if shared.state.interrupted: break - state.job = f"{i + 1}/{len(files)}" - state.job_no = i + shared.state.job = f"{i + 1}/{len(files)}" + shared.state.job_no = i img = Image.open(filepath) if img.mode not in ('RGB', 'L'): @@ -270,4 +267,4 @@ class Script(scripts_manager.Script): all_images.append(out_img) - return get_processed(p, all_images, p.seed, "", all_prompts=all_prompts, all_seeds=all_seeds, all_negative_prompts=all_negative, infotexts=infotexts) + return processing.get_processed(p, all_images, p.seed, "", all_prompts=all_prompts, all_seeds=all_seeds, all_negative_prompts=all_negative, infotexts=infotexts)