File size: 612 Bytes
1cbfd2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import gradio as gr
import kornia as K
from kornia.core import Tensor


def enhance(file):      
    # load the image using the rust backend          
    img: Tensor = K.io.load_image(file.name, K.io.ImageLoadType.RGB32)
    img = img[None]  # 1xCxHxW / fp32 / [0, 1]
    return K.utils.tensor_to_image(img)


examples = [
    ['examples/foto1B.jpg'],
    ['examples/foto1A.jpg'],
]


iface = gr.Interface(
    enhance,
    [
        gr.inputs.Image(type="file"),
    ],
    "image",
    examples=examples,
    # title=title,
    # description=description,
    # article=article,
    live=True
)

iface.launch()