lllyasviel commited on
Commit
967c482
·
1 Parent(s): 3524600
Files changed (2) hide show
  1. modules/core.py +1 -1
  2. modules/cv2win32.py +1 -1
modules/core.py CHANGED
@@ -79,7 +79,7 @@ def get_previewer(device, latent_format):
79
  with torch.no_grad():
80
  x_sample = taesd.decoder(torch.nn.functional.avg_pool2d(x0, kernel_size=(2, 2))).detach() * 255.0
81
  x_sample = einops.rearrange(x_sample, 'b c h w -> b h w c')
82
- x_sample = x_sample.cpu().numpy()[..., ::-1].copy().clip(0, 255).astype(np.uint8)
83
  for i, s in enumerate(x_sample):
84
  show_preview(f'OpenCV Diffusion Preview {i}', s, title=f'Preview Image {i} [{step}/{total_steps}]')
85
 
 
79
  with torch.no_grad():
80
  x_sample = taesd.decoder(torch.nn.functional.avg_pool2d(x0, kernel_size=(2, 2))).detach() * 255.0
81
  x_sample = einops.rearrange(x_sample, 'b c h w -> b h w c')
82
+ x_sample = x_sample.cpu().numpy().clip(0, 255).astype(np.uint8)
83
  for i, s in enumerate(x_sample):
84
  show_preview(f'OpenCV Diffusion Preview {i}', s, title=f'Preview Image {i} [{step}/{total_steps}]')
85
 
modules/cv2win32.py CHANGED
@@ -4,7 +4,7 @@ import cv2
4
  def show_preview(flag, img, title=None):
5
  if title is None:
6
  title = flag
7
- cv2.imshow(flag, img)
8
  cv2.setWindowTitle(flag, title)
9
  cv2.setWindowProperty(flag, cv2.WND_PROP_TOPMOST, 1)
10
  cv2.waitKey(1)
 
4
  def show_preview(flag, img, title=None):
5
  if title is None:
6
  title = flag
7
+ cv2.imshow(flag, img[:, :, ::-1].copy())
8
  cv2.setWindowTitle(flag, title)
9
  cv2.setWindowProperty(flag, cv2.WND_PROP_TOPMOST, 1)
10
  cv2.waitKey(1)