Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
added app.py and image files
Browse files- app.py +32 -0
- examples/foto1A.jpg +0 -0
- examples/foto1B.jpg +0 -0
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import kornia as K
|
3 |
+
from kornia.core import Tensor
|
4 |
+
|
5 |
+
|
6 |
+
def enhance(file):
|
7 |
+
# load the image using the rust backend
|
8 |
+
img: Tensor = K.io.load_image(file.name, K.io.ImageLoadType.RGB32)
|
9 |
+
img = img[None] # 1xCxHxW / fp32 / [0, 1]
|
10 |
+
return K.utils.tensor_to_image(img)
|
11 |
+
|
12 |
+
|
13 |
+
examples = [
|
14 |
+
['examples/foto1B.jpg'],
|
15 |
+
['examples/foto1A.jpg'],
|
16 |
+
]
|
17 |
+
|
18 |
+
|
19 |
+
iface = gr.Interface(
|
20 |
+
enhance,
|
21 |
+
[
|
22 |
+
gr.inputs.Image(type="file"),
|
23 |
+
],
|
24 |
+
"image",
|
25 |
+
examples=examples,
|
26 |
+
# title=title,
|
27 |
+
# description=description,
|
28 |
+
# article=article,
|
29 |
+
live=True
|
30 |
+
)
|
31 |
+
|
32 |
+
iface.launch()
|
examples/foto1A.jpg
ADDED
examples/foto1B.jpg
ADDED