File size: 1,150 Bytes
238eab6
 
 
 
 
f3aa338
c075ea7
 
f3aa338
238eab6
c075ea7
238eab6
 
 
 
 
9281d9e
 
238eab6
9281d9e
 
 
71bcdff
9281d9e
 
 
 
 
 
 
 
 
238eab6
cd39380
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
33
34
35
import gradio as gr
# project
from exposure_enhancement import enhance_image_exposure

# inputs, fn, and ouputs
examples=[
    ["demo/1.jpg"],
    ["demo/2.bmp"]
]

def enhance_image(image, gamma=0.6, lambda_=0.15, sigma=3, lime=True, bc=1, bs=1, be=1, eps=1e-3):
    # enhance image
    enhanced_image = enhance_image_exposure(image, gamma, lambda_, not lime, sigma=sigma, bc=bc, bs=bs, be=be, eps=eps)
    
    return enhanced_image

def update(name):
    return f"Welcome to Gradio, {name}!"

with gr.Blocks() as demo:
    gr.Markdown("Input an image below then click **Run** or use the cached examples for quick results. For quicker processing (typically 1-2 minutes), it's suggested to use low-exposure images of 500x500 pixels.")
    with gr.Row():
        inp = gr.Image(label="Input Image", type="numpy", sources=["upload"])
        out = gr.Image(label="Enhanced Image", type="numpy")
        
    with gr.Row():
        btn = gr.Button("Run")
        btn.click(fn=enhance_image, inputs=inp, outputs=out)
        btn = gr.ClearButton()
        
    with gr.Row():
        gr.Examples(examples=examples, inputs=inp)

demo.launch(share=True)