mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
i
This commit is contained in:
+1
-1
@@ -79,7 +79,7 @@ def get_previewer(device, latent_format):
|
||||
with torch.no_grad():
|
||||
x_sample = taesd.decoder(torch.nn.functional.avg_pool2d(x0, kernel_size=(2, 2))).detach() * 255.0
|
||||
x_sample = einops.rearrange(x_sample, 'b c h w -> b h w c')
|
||||
x_sample = x_sample.cpu().numpy()[..., ::-1].copy().clip(0, 255).astype(np.uint8)
|
||||
x_sample = x_sample.cpu().numpy().clip(0, 255).astype(np.uint8)
|
||||
for i, s in enumerate(x_sample):
|
||||
show_preview(f'OpenCV Diffusion Preview {i}', s, title=f'Preview Image {i} [{step}/{total_steps}]')
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import cv2
|
||||
def show_preview(flag, img, title=None):
|
||||
if title is None:
|
||||
title = flag
|
||||
cv2.imshow(flag, img)
|
||||
cv2.imshow(flag, img[:, :, ::-1].copy())
|
||||
cv2.setWindowTitle(flag, title)
|
||||
cv2.setWindowProperty(flag, cv2.WND_PROP_TOPMOST, 1)
|
||||
cv2.waitKey(1)
|
||||
|
||||
Reference in New Issue
Block a user