rupeshs commited on
Commit
f50c4e6
1 Parent(s): 80c15fc

image upscale updated

Browse files
Files changed (1) hide show
  1. frontend/webui/text_to_image_ui.py +6 -5
frontend/webui/text_to_image_ui.py CHANGED
@@ -14,7 +14,7 @@ from scipy.ndimage import zoom
14
  import numpy as np
15
  from PIL import Image
16
  from super_image import CarnModel,ImageLoader
17
- import torchvision.transforms as T
18
 
19
  random_enabled = True
20
 
@@ -81,10 +81,11 @@ def generate_text_to_image(
81
  for image in images:
82
  #out_images.append(image.resize((768, 768),resample=Image.LANCZOS))
83
  in_image = ImageLoader.load_image(image)
84
- up_image =upscaler(in_image)
85
- transform = T.ToPILImage()
86
- pil_img=transform(up_image.squeeze())
87
- out_images.append(pil_img)
 
88
 
89
  return out_images
90
 
 
14
  import numpy as np
15
  from PIL import Image
16
  from super_image import CarnModel,ImageLoader
17
+ import cv2
18
 
19
  random_enabled = True
20
 
 
81
  for image in images:
82
  #out_images.append(image.resize((768, 768),resample=Image.LANCZOS))
83
  in_image = ImageLoader.load_image(image)
84
+ up_image = upscaler(in_image)
85
+ up_image = up_image.data.cpu().numpy()
86
+ up_image = up_image[0].transpose((1, 2, 0)) * 255.0
87
+ up_image = cv2.cvtColor(up_image, cv2.COLOR_BGR2RGB)
88
+ out_images.append(Image.fromarray(up_image))
89
 
90
  return out_images
91