Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,11 @@ import gradio as gr
|
|
2 |
from predict import predict_masks, get_mask_for_label
|
3 |
import glob
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
demo = gr.Blocks()
|
6 |
|
7 |
with demo:
|
@@ -28,7 +33,7 @@ with demo:
|
|
28 |
|
29 |
gr.Markdown("**Examples:**")
|
30 |
submit_button.click(predict_masks, inputs=[input_image], outputs=[output_mask, output_heading, labels_dropdown])
|
31 |
-
generate_mask_button.click(
|
32 |
|
33 |
gr.Markdown('\n Demo created by: <a href=\"https://www.linkedin.com/in/theo-belen-halimi/">Théo Belen-Halimi</a>')
|
34 |
|
|
|
2 |
from predict import predict_masks, get_mask_for_label
|
3 |
import glob
|
4 |
|
5 |
+
def wrapper_func(input_img_path, selected_label):
|
6 |
+
output_result, output_heading, labels = predict_masks(input_img_path)
|
7 |
+
mask = get_mask_for_label(output_result, selected_label)
|
8 |
+
return mask
|
9 |
+
|
10 |
demo = gr.Blocks()
|
11 |
|
12 |
with demo:
|
|
|
33 |
|
34 |
gr.Markdown("**Examples:**")
|
35 |
submit_button.click(predict_masks, inputs=[input_image], outputs=[output_mask, output_heading, labels_dropdown])
|
36 |
+
generate_mask_button.click(wrapper_func, inputs=[input_image, labels_dropdown], outputs=[selected_mask])
|
37 |
|
38 |
gr.Markdown('\n Demo created by: <a href=\"https://www.linkedin.com/in/theo-belen-halimi/">Théo Belen-Halimi</a>')
|
39 |
|