Spaces:
Running
Running
1. refactor variables
Browse files2. fix clear button function
app.py
CHANGED
|
@@ -180,7 +180,7 @@ with gr.Blocks() as demo:
|
|
| 180 |
clear_button = gr.Button("Clear")
|
| 181 |
with gr.Column(scale=2):
|
| 182 |
output_mask = gr.Image(label="Segmentation Mask", type="numpy")
|
| 183 |
-
|
| 184 |
label="Summary",
|
| 185 |
interactive=False,
|
| 186 |
lines=3,
|
|
@@ -188,9 +188,9 @@ with gr.Blocks() as demo:
|
|
| 188 |
show_copy_button=True
|
| 189 |
)
|
| 190 |
|
| 191 |
-
text_input.submit(segment_and_display, inputs=[image_input, text_input], outputs=[output_mask,
|
| 192 |
-
segment_button.click(segment_and_display, inputs=[image_input, text_input], outputs=[output_mask,
|
| 193 |
-
clear_button.click(lambda: (None, ""), inputs=None, outputs=[image_input, text_input])
|
| 194 |
|
| 195 |
|
| 196 |
demo.launch()
|
|
|
|
| 180 |
clear_button = gr.Button("Clear")
|
| 181 |
with gr.Column(scale=2):
|
| 182 |
output_mask = gr.Image(label="Segmentation Mask", type="numpy")
|
| 183 |
+
summary = gr.Textbox(
|
| 184 |
label="Summary",
|
| 185 |
interactive=False,
|
| 186 |
lines=3,
|
|
|
|
| 188 |
show_copy_button=True
|
| 189 |
)
|
| 190 |
|
| 191 |
+
text_input.submit(segment_and_display, inputs=[image_input, text_input], outputs=[output_mask, summary])
|
| 192 |
+
segment_button.click(segment_and_display, inputs=[image_input, text_input], outputs=[output_mask, summary])
|
| 193 |
+
clear_button.click(lambda: (None, "", None, ""), inputs=None, outputs=[image_input, text_input, output_mask, summary])
|
| 194 |
|
| 195 |
|
| 196 |
demo.launch()
|