Spaces:
Running
Running
image upscale updated
Browse files
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
|
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 |
-
|
86 |
-
|
87 |
-
|
|
|
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 |
|