lllyasviel commited on
Commit
2d98a52
·
1 Parent(s): a8aa05c
Files changed (2) hide show
  1. modules/core.py +4 -3
  2. modules/default_pipeline.py +3 -0
modules/core.py CHANGED
@@ -72,6 +72,10 @@ def get_previewer(device, latent_format):
72
  return taesd
73
 
74
 
 
 
 
 
75
  @torch.no_grad()
76
  def ksampler(model, positive, negative, latent, seed=None, steps=30, cfg=9.0, sampler_name='euler_ancestral', scheduler='normal', denoise=1.0, disable_noise=False, start_step=None, last_step=None, force_full_denoise=False):
77
  seed = seed if isinstance(seed, int) else random.randint(1, 2 ** 64)
@@ -104,9 +108,6 @@ def ksampler(model, positive, negative, latent, seed=None, steps=30, cfg=9.0, sa
104
  out = latent.copy()
105
  out["samples"] = samples
106
 
107
- if previewer:
108
- cv2.destroyAllWindows()
109
-
110
  return out
111
 
112
 
 
72
  return taesd
73
 
74
 
75
+ def close_all_preview():
76
+ cv2.destroyAllWindows()
77
+
78
+
79
  @torch.no_grad()
80
  def ksampler(model, positive, negative, latent, seed=None, steps=30, cfg=9.0, sampler_name='euler_ancestral', scheduler='normal', denoise=1.0, disable_noise=False, start_step=None, last_step=None, force_full_denoise=False):
81
  seed = seed if isinstance(seed, int) else random.randint(1, 2 ** 64)
 
108
  out = latent.copy()
109
  out["samples"] = samples
110
 
 
 
 
111
  return out
112
 
113
 
modules/default_pipeline.py CHANGED
@@ -42,4 +42,7 @@ def process(positive_prompt, negative_prompt, width=1024, height=1024, batch_siz
42
  decoded_latent = core.decode_vae(vae=xl_refiner.vae, latent_image=sampled_latent)
43
 
44
  images = core.image_to_numpy(decoded_latent)
 
 
 
45
  return images
 
42
  decoded_latent = core.decode_vae(vae=xl_refiner.vae, latent_image=sampled_latent)
43
 
44
  images = core.image_to_numpy(decoded_latent)
45
+
46
+ core.close_all_preview()
47
+
48
  return images