From dab9403b8f704642f5bcdaea4f19aea8666a4f8c Mon Sep 17 00:00:00 2001 From: Quinn Dawkins Date: Thu, 8 Dec 2022 00:35:51 -0500 Subject: [PATCH] Fix slow conversion to image in SD web gui (#586) --- web/models/stable_diffusion/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/models/stable_diffusion/main.py b/web/models/stable_diffusion/main.py index f2cefc48..87157927 100644 --- a/web/models/stable_diffusion/main.py +++ b/web/models/stable_diffusion/main.py @@ -106,8 +106,8 @@ def stable_diff_inf( latents_numpy = latents.detach().numpy() image = vae.forward((latents_numpy,)) image = torch.from_numpy(image) - image = image.detach().cpu().permute(0, 2, 3, 1).numpy() - images = (image * 255).round().astype("uint8") + image = (image.detach().cpu().permute(0, 2, 3, 1) * 255.0).numpy() + images = image.round().astype("uint8") pil_images = [Image.fromarray(image) for image in images] out_img = pil_images[0]