rupeshs commited on
Commit
7f3be1a
1 Parent(s): 79103c8

added upscaler

Browse files
frontend/webui/text_to_image_ui.py CHANGED
@@ -13,6 +13,7 @@ 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
 
@@ -21,7 +22,7 @@ previous_width = 0
21
  previous_height = 0
22
  previous_model_id = ""
23
  previous_num_of_images = 0
24
-
25
 
26
  def generate_text_to_image(
27
  prompt,
@@ -77,8 +78,11 @@ def generate_text_to_image(
77
  previous_num_of_images = 1
78
  out_images = []
79
  for image in images:
80
- out_images.append(image.resize((768, 768),resample=Image.LANCZOS))
81
-
 
 
 
82
  return out_images
83
 
84
 
 
13
  from scipy.ndimage import zoom
14
  import numpy as np
15
  from PIL import Image
16
+ from super_image import CarnModel,ImageLoader
17
 
18
  random_enabled = True
19
 
 
22
  previous_height = 0
23
  previous_model_id = ""
24
  previous_num_of_images = 0
25
+ upscaler = CarnModel.from_pretrained('eugenesiow/carn-bam', scale=2)
26
 
27
  def generate_text_to_image(
28
  prompt,
 
78
  previous_num_of_images = 1
79
  out_images = []
80
  for image in images:
81
+ #out_images.append(image.resize((768, 768),resample=Image.LANCZOS))
82
+ in_image = ImageLoader.load_image(image)
83
+ up_image =upscaler(in_image)
84
+ out_images.append(up_image)
85
+
86
  return out_images
87
 
88
 
requirements.txt CHANGED
@@ -10,4 +10,5 @@ onnxruntime==1.16.1
10
  pydantic==2.4.2
11
  typing-extensions==4.8.0
12
  pyyaml
13
- gradio==3.39.0
 
 
10
  pydantic==2.4.2
11
  typing-extensions==4.8.0
12
  pyyaml
13
+ gradio==3.39.0
14
+ super-image==0.1.7