Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
•
495efc8
1
Parent(s):
19a285e
numpy not needed (#1)
Browse files- numpy not needed (dcd6fa4cea3217fc398f750b783a6abb2e073154)
Co-authored-by: Edgar Riba <[email protected]>
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 |
-
|
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
|
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],
|