Spaces:
Runtime error
Runtime error
osanseviero
commited on
Commit
•
53e1909
1
Parent(s):
2fddd2e
Update app.py
Browse files
app.py
CHANGED
@@ -4,13 +4,11 @@ import kornia as K
|
|
4 |
from kornia.core import Tensor
|
5 |
|
6 |
|
7 |
-
|
8 |
def enhance(file, brightness, contrast, saturation, gamma, hue):
|
9 |
# load the image using the rust backend
|
10 |
img: Tensor = K.io.load_image(file.name, K.io.ImageLoadType.RGB32)
|
11 |
img = img[None] # 1xCxHxW / fp32 / [0, 1]
|
12 |
|
13 |
-
|
14 |
# apply tensor image enhancement
|
15 |
x_out: Tensor = K.enhance.adjust_brightness(img, float(brightness))
|
16 |
x_out = K.enhance.adjust_contrast(x_out, float(contrast))
|
@@ -41,13 +39,11 @@ iface = gr.Interface(
|
|
41 |
gr.inputs.Slider(minimum=0, maximum=4, step=0.1, default=0, label="Hue"),
|
42 |
],
|
43 |
"image",
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
examples=examples,
|
49 |
# title=title,
|
50 |
# description=description,
|
51 |
# article=article,
|
52 |
live=True
|
53 |
)
|
|
|
|
|
|
4 |
from kornia.core import Tensor
|
5 |
|
6 |
|
|
|
7 |
def enhance(file, brightness, contrast, saturation, gamma, hue):
|
8 |
# load the image using the rust backend
|
9 |
img: Tensor = K.io.load_image(file.name, K.io.ImageLoadType.RGB32)
|
10 |
img = img[None] # 1xCxHxW / fp32 / [0, 1]
|
11 |
|
|
|
12 |
# apply tensor image enhancement
|
13 |
x_out: Tensor = K.enhance.adjust_brightness(img, float(brightness))
|
14 |
x_out = K.enhance.adjust_contrast(x_out, float(contrast))
|
|
|
39 |
gr.inputs.Slider(minimum=0, maximum=4, step=0.1, default=0, label="Hue"),
|
40 |
],
|
41 |
"image",
|
|
|
|
|
|
|
|
|
42 |
examples=examples,
|
43 |
# title=title,
|
44 |
# description=description,
|
45 |
# article=article,
|
46 |
live=True
|
47 |
)
|
48 |
+
|
49 |
+
iface.launch()
|