Brian Gabini
commited on
Commit
·
9281d9e
1
Parent(s):
c075ea7
feat: change gradio implementation
Browse files
app.py
CHANGED
@@ -3,10 +3,6 @@ import gradio as gr
|
|
3 |
from exposure_enhancement import enhance_image_exposure
|
4 |
|
5 |
# inputs, fn, and ouputs
|
6 |
-
inputs=[
|
7 |
-
gr.Image(type="numpy")
|
8 |
-
]
|
9 |
-
outputs=["image"]
|
10 |
examples=[
|
11 |
["demo/1.jpg"],
|
12 |
["demo/2.bmp"]
|
@@ -18,14 +14,23 @@ def enhance_image(image, gamma=0.6, lambda_=0.15, sigma=3, lime=True, bc=1, bs=1
|
|
18 |
|
19 |
return enhanced_image
|
20 |
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
|
30 |
if __name__ == "__main__":
|
31 |
-
|
|
|
3 |
from exposure_enhancement import enhance_image_exposure
|
4 |
|
5 |
# inputs, fn, and ouputs
|
|
|
|
|
|
|
|
|
6 |
examples=[
|
7 |
["demo/1.jpg"],
|
8 |
["demo/2.bmp"]
|
|
|
14 |
|
15 |
return enhanced_image
|
16 |
|
17 |
+
def update(name):
|
18 |
+
return f"Welcome to Gradio, {name}!"
|
19 |
|
20 |
+
with gr.Blocks() as demo:
|
21 |
+
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.")
|
22 |
+
with gr.Row():
|
23 |
+
inp = gr.Image(label="Input Image", type="numpy")
|
24 |
+
out = gr.Image(label="Enhanced Image", type="numpy")
|
25 |
+
|
26 |
+
with gr.Row():
|
27 |
+
btn = gr.Button("Run")
|
28 |
+
btn.click(fn=enhance_image, inputs=inp, outputs=out)
|
29 |
+
btn = gr.ClearButton()
|
30 |
+
|
31 |
+
with gr.Row():
|
32 |
+
gr.Examples(examples=examples, inputs=inp)
|
33 |
|
34 |
|
35 |
if __name__ == "__main__":
|
36 |
+
demo.launch(share=True)
|