Brian Gabini
refactor: hide source for output image
5baee12
import gradio as gr
# project
from exposure_enhancement import enhance_image_exposure
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
examples=[
["demo/1.jpg"],
["demo/2.bmp"],
["demo/3.jpg"],
]
with gr.Blocks() as interface:
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():
input_image = gr.Image(label="Input Image", type="numpy", sources=["upload"], interactive=True)
output_image = gr.Image(label="Enhanced Image", type="numpy", sources=["upload"], interactive=False)
with gr.Row():
submit_btn = gr.Button("Run")
submit_btn.click(fn=enhance_image, inputs=input_image, outputs=output_image)
clear_btn = gr.ClearButton(components=[input_image, output_image])
with gr.Row():
gr.Examples(examples=examples, fn=enhance_image,inputs=input_image, outputs=output_image, cache_examples=True)
if __name__ == "__main__":
interface.launch(share=True)