File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed
web/models/stable_diffusion Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change 11import torch
22import os
33from PIL import Image
4- import torchvision .transforms as T
54from tqdm .auto import tqdm
65from models .stable_diffusion .cache_objects import model_cache
76from models .stable_diffusion .stable_args import args
@@ -268,10 +267,8 @@ def stable_diff_inf(
268267 print (f"\n Total image generation time: { total_time } sec" )
269268
270269 # generate outputs to web.
271- transform = T .ToPILImage ()
272- pil_images = [
273- transform (image ) for image in torch .from_numpy (images ).to (torch .uint8 )
274- ]
270+ images = torch .from_numpy (images ).to (torch .uint8 ).permute (0 , 2 , 3 , 1 )
271+ pil_images = [Image .fromarray (image ) for image in images .numpy ()]
275272
276273 text_output = f"prompt={ args .prompts } "
277274 text_output += f"\n negative prompt={ args .negative_prompts } "
You can’t perform that action at this time.
0 commit comments