simple upscaler
Browse files
frontend/webui/text_to_image_ui.py
CHANGED
|
@@ -10,6 +10,9 @@ from frontend.utils import is_reshape_required
|
|
| 10 |
from app_settings import AppSettings
|
| 11 |
from constants import DEVICE
|
| 12 |
from frontend.utils import enable_openvino_controls
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
random_enabled = True
|
| 15 |
|
|
@@ -72,8 +75,13 @@ def generate_text_to_image(
|
|
| 72 |
previous_height = 384
|
| 73 |
previous_model_id = model_id
|
| 74 |
previous_num_of_images = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
-
return
|
| 77 |
|
| 78 |
|
| 79 |
def get_text_to_image_ui(app_settings: AppSettings) -> None:
|
|
|
|
| 10 |
from app_settings import AppSettings
|
| 11 |
from constants import DEVICE
|
| 12 |
from frontend.utils import enable_openvino_controls
|
| 13 |
+
from scipy.ndimage import zoom
|
| 14 |
+
import numpy as np
|
| 15 |
+
from PIL import Image
|
| 16 |
|
| 17 |
random_enabled = True
|
| 18 |
|
|
|
|
| 75 |
previous_height = 384
|
| 76 |
previous_model_id = model_id
|
| 77 |
previous_num_of_images = 1
|
| 78 |
+
out_images = []
|
| 79 |
+
for image in images:
|
| 80 |
+
img_arr = np.array(image)
|
| 81 |
+
upscaled_image = zoom(img_arr, (2, 2, 1), order=3)
|
| 82 |
+
out_images.append(Image.fromarray(upscaled_image.astype(np.uint8)))
|
| 83 |
|
| 84 |
+
return out_images
|
| 85 |
|
| 86 |
|
| 87 |
def get_text_to_image_ui(app_settings: AppSettings) -> None:
|