Update app.py
Browse files
app.py
CHANGED
@@ -60,12 +60,30 @@ def generate_image(seed_image):
|
|
60 |
return inp, v
|
61 |
|
62 |
# Create Gradio interface
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
70 |
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
return inp, v
|
61 |
|
62 |
# Create Gradio interface
|
63 |
+
with gr.Blocks() as demo:
|
64 |
+
gr.Markdown(DESCRIPTION)
|
65 |
+
with gr.Row():
|
66 |
+
input_image = gr.File(label='Input Image')
|
67 |
+
output_image1 = gr.Image(label='Input LoS Magnetogram', type='pil', interactive=False)
|
68 |
+
output_image2 = gr.Image(label='Predicted LoS Magnetogram in 24 hours', type='pil', interactive=False)
|
69 |
+
# Buttons are placed in a nested Row inside the main Row to align them directly under the image
|
70 |
+
with gr.Row():
|
71 |
+
clear_button = gr.Button('Clear')
|
72 |
+
process_button = gr.Button('Generate')
|
73 |
+
|
74 |
|
75 |
+
# Binding the process button to the function
|
76 |
+
process_button.click(
|
77 |
+
fn=generate_image,
|
78 |
+
inputs=input_image,
|
79 |
+
outputs=[output_image1, output_image2]
|
80 |
+
)
|
81 |
+
|
82 |
+
# Clear button to reset the input image
|
83 |
+
clear_button.click(
|
84 |
+
fn=lambda: None, # Clears the input
|
85 |
+
inputs=None,
|
86 |
+
outputs=input_image
|
87 |
+
)
|
88 |
+
|
89 |
+
demo.launch()
|