From f4b61492fb0804a0b6c9fa7e1dc263b411d3b358 Mon Sep 17 00:00:00 2001 From: "ilian.iliev" Date: Sun, 21 May 2023 15:17:02 +0300 Subject: [PATCH] samples_save option check added --- scripts/eyemask/script.py | 30 ++++++++++++++++++++---------- scripts/eyemask/script_embedded.py | 30 ++++++++++++++++++++---------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/scripts/eyemask/script.py b/scripts/eyemask/script.py index 019427d..1b06067 100644 --- a/scripts/eyemask/script.py +++ b/scripts/eyemask/script.py @@ -209,22 +209,32 @@ def execute(self, p, print(e) save_prompt = orig_image_info + updated_info = self.update_info(initial_info, em_params) + output_images.append(processed.images[0]) + p.all_seeds.append(start_seed) + p.all_prompts.append(save_prompt) + p.infotexts.append(updated_info) + if em_include_mask and (n == iterations - 1 or (is_txt2img and em_redraw_original)): output_images.append(mask) + p.all_seeds.append(start_seed) + p.all_prompts.append(mask_prompt) + p.infotexts.append(updated_info) shared.state.current_image = processed.images[0] - images.save_image( - processed.images[0], - p.outpath_samples, - "", - start_seed, - save_prompt, - shared.opts.samples_format, - info=self.update_info(initial_info, em_params), - p=p - ) + if shared.opts.samples_save: + images.save_image( + processed.images[0], + p.outpath_samples, + "", + start_seed, + save_prompt, + shared.opts.samples_format, + info=updated_info, + p=p + ) devices.torch_gc() gc.collect() diff --git a/scripts/eyemask/script_embedded.py b/scripts/eyemask/script_embedded.py index 0f388ea..aef4cac 100644 --- a/scripts/eyemask/script_embedded.py +++ b/scripts/eyemask/script_embedded.py @@ -190,22 +190,32 @@ def execute_postprocess(self, p, processed, print(e) save_prompt = orig_image_info + updated_info = self.update_info(initial_info, em_params) + processed.images.append(processed_em.images[0]) + processed.all_seeds.append(start_seed) + processed.all_prompts.append(save_prompt) + processed.infotexts.append(updated_info) + if em_include_mask and (n == iterations - 1): processed.images.append(mask) + processed.all_seeds.append(start_seed) + processed.all_prompts.append(mask_prompt) + processed.infotexts.append(updated_info) shared.state.current_image = processed_em.images[0] - images.save_image( - processed_em.images[0], - p_em.outpath_samples, - "", - start_seed, - save_prompt, - shared.opts.samples_format, - info=self.update_info(initial_info, em_params), - p=p_em - ) + if shared.opts.samples_save: + images.save_image( + processed_em.images[0], + p_em.outpath_samples, + "", + start_seed, + save_prompt, + shared.opts.samples_format, + info=updated_info, + p=p_em + ) devices.torch_gc() gc.collect()