Spaces:
Sleeping
Sleeping
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, | |
examples=examples | |
) | |
if __name__ == "__main__": | |
iface.launch(share=True) | |