File size: 1,168 Bytes
238eab6 d680b92 f3aa338 238eab6 854505c |
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 36 37 |
import gradio as gr
# project
from exposure_enhancement import enhance_image_exposure
# inputs, fn, and ouputs
inputs=[
gr.Image(type="numpy"),
gr.Slider(minimum=0, maximum=1, value=0.6, label="Gamma", info="The gamma correction parameter."),
gr.Slider(minimum=0, maximum=1, value=0.15, label="Lambda", info="The weight for balancing the two terms in the illumination refinement optimization objective."),
gr.Number(value=3, minimum=0, label="Sigma", info="Spatial standard deviation for spatial affinity based Gaussian weights.")
]
outputs=["image"]
examples=[
["demo/1.jpg", 0.6, 0.15, 3],
["demo/2.bmp", 0.6, 0.15, 3]
]
def enhance_image(image, gamma, lambda_, sigma, 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
iface = gr.Interface(
fn=enhance_image,
inputs=inputs,
outputs=outputs,
title=title,
description=description,
examples=examples
)
if __name__ == "__main__":
iface.launch(share=True)
|