diff --git a/__pycache__/ksampler_fun.cpython-312.pyc b/__pycache__/ksampler_fun.cpython-312.pyc index 71d151d..e816d6a 100644 Binary files a/__pycache__/ksampler_fun.cpython-312.pyc and b/__pycache__/ksampler_fun.cpython-312.pyc differ diff --git a/ksampler_fun.py b/ksampler_fun.py index 2f0a347..da1ef40 100644 --- a/ksampler_fun.py +++ b/ksampler_fun.py @@ -53,7 +53,7 @@ def fun_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, neg out = latent.copy() out["samples"] = samples - return (out, None) # Return None for preview_latents since we're saving directly + return (out, callback.get_results()) # Return the results from the callback class PreviewCallback: def __init__(self, latent, preview_steps_list, vae, model): @@ -65,11 +65,15 @@ class PreviewCallback: self.type = "output" self.prefix_append = "" self.compress_level = 4 + self.results = [] # Store results for later retrieval # Initialize previewer using the model's latent_format self.previewer = latent_preview.get_previewer("cpu", model.model.latent_format) if self.previewer is None: print("Warning: No preview method available, falling back to full VAE for previews") + def get_results(self): + return {"ui": {"images": self.results}} + def __call__(self, step, denoised, x, total_steps): if step in self.preview_steps_list: # Create a copy of the current state @@ -115,6 +119,9 @@ class PreviewCallback: "output_id": "preview_images" } + # Add to results list + self.results.append(result) + print(f"Saved preview image to: {file_path}") class KSampler: