edgarriba commited on
Commit
dcd6fa4
1 Parent(s): 19a285e

numpy not needed

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -1,9 +1,7 @@
1
  import gradio as gr
2
 
3
  import kornia as K
4
- from kornia.core import Tensor
5
-
6
- import numpy as np
7
 
8
  def rescale_aa(file, height, width):
9
 
@@ -12,13 +10,10 @@ def rescale_aa(file, height, width):
12
 
13
  img_rescale: Tensor = K.geometry.rescale(img, (float(height),float(width)),antialias=False)
14
  img_rescale_aa: Tensor = K.geometry.rescale(img, (float(height),float(width)),antialias=True)
15
- img_rescale = K.utils.tensor_to_image(img_rescale)
16
- img_rescale_aa = K.utils.tensor_to_image(img_rescale_aa)
17
- img_out = np.concatenate([img_rescale,img_rescale_aa],axis=1)
18
 
19
  # when antialiasing , some values are going greater than 1 i.e 1.00001 which is giving error while displaying the output image,so clipping the output values from 0 to 1
20
- return np.clip(img_out ,0,1)
21
-
22
 
23
  examples = [
24
  ["examples/a.png",1,1],
 
1
  import gradio as gr
2
 
3
  import kornia as K
4
+ from kornia.core import concatenate, Tensor
 
 
5
 
6
  def rescale_aa(file, height, width):
7
 
 
10
 
11
  img_rescale: Tensor = K.geometry.rescale(img, (float(height),float(width)),antialias=False)
12
  img_rescale_aa: Tensor = K.geometry.rescale(img, (float(height),float(width)),antialias=True)
13
+ img_out = concatenate([img_rescale, img_rescale_aa], -1)
 
 
14
 
15
  # when antialiasing , some values are going greater than 1 i.e 1.00001 which is giving error while displaying the output image,so clipping the output values from 0 to 1
16
+ return K.utils.tensor_to_image(img_out.clamp_(0, 1))
 
17
 
18
  examples = [
19
  ["examples/a.png",1,1],