Brian Gabini
commited on
Commit
·
e3a97b8
1
Parent(s):
e274eca
refactor: change var names
Browse files
app.py
CHANGED
@@ -2,31 +2,31 @@ import gradio as gr
|
|
2 |
# project
|
3 |
from exposure_enhancement import enhance_image_exposure
|
4 |
|
5 |
-
examples=[
|
6 |
-
["demo/1.jpg"],
|
7 |
-
["demo/2.bmp"],
|
8 |
-
["demo/3.jpg"],
|
9 |
-
]
|
10 |
-
|
11 |
def enhance_image(image, gamma=0.6, lambda_=0.15, sigma=3, lime=True, bc=1, bs=1, be=1, eps=1e-3):
|
12 |
# enhance image
|
13 |
enhanced_image = enhance_image_exposure(image, gamma, lambda_, not lime, sigma=sigma, bc=bc, bs=bs, be=be, eps=eps)
|
14 |
|
15 |
return enhanced_image
|
16 |
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
with gr.Blocks() as
|
19 |
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.")
|
20 |
with gr.Row():
|
21 |
-
|
22 |
-
|
23 |
|
24 |
with gr.Row():
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
|
29 |
with gr.Row():
|
30 |
-
gr.Examples(examples=examples, fn=enhance_image,inputs=
|
31 |
|
32 |
-
|
|
|
|
2 |
# project
|
3 |
from exposure_enhancement import enhance_image_exposure
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
def enhance_image(image, gamma=0.6, lambda_=0.15, sigma=3, lime=True, bc=1, bs=1, be=1, eps=1e-3):
|
6 |
# enhance image
|
7 |
enhanced_image = enhance_image_exposure(image, gamma, lambda_, not lime, sigma=sigma, bc=bc, bs=bs, be=be, eps=eps)
|
8 |
|
9 |
return enhanced_image
|
10 |
|
11 |
+
examples=[
|
12 |
+
["demo/1.jpg"],
|
13 |
+
["demo/2.bmp"],
|
14 |
+
["demo/3.jpg"],
|
15 |
+
]
|
16 |
|
17 |
+
with gr.Blocks() as interface:
|
18 |
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.")
|
19 |
with gr.Row():
|
20 |
+
input_image = gr.Image(label="Input Image", type="numpy", sources=["upload"], interactive=True)
|
21 |
+
output_image = gr.Image(label="Enhanced Image", type="numpy", interactive=True)
|
22 |
|
23 |
with gr.Row():
|
24 |
+
submit_btn = gr.Button("Run")
|
25 |
+
submit_btn.click(fn=enhance_image, inputs=input_image, outputs=output_image)
|
26 |
+
submit_btn = gr.ClearButton(components=["input_image", "output_image"])
|
27 |
|
28 |
with gr.Row():
|
29 |
+
gr.Examples(examples=examples, fn=enhance_image,inputs=input_image, outputs=output_image, cache_examples=True)
|
30 |
|
31 |
+
if __name__ == "__main__":
|
32 |
+
interface.launch(share=True)
|