Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -27,8 +27,8 @@ def image_objects(image):
|
|
27 |
|
28 |
def get_seg(image, object):
|
29 |
image = img_resize(image)
|
30 |
-
|
31 |
-
|
32 |
seg_box=[]
|
33 |
for i in range(len(pred)):
|
34 |
#object_number = int(object.split('_')[0])
|
@@ -44,7 +44,8 @@ def get_seg(image, object):
|
|
44 |
seg_out=segmented_image.astype(np.uint8)
|
45 |
seg_box.append(seg_out)
|
46 |
|
47 |
-
return(seg_box)
|
|
|
48 |
|
49 |
|
50 |
|
@@ -54,9 +55,8 @@ app = gr.Blocks()
|
|
54 |
with app:
|
55 |
gr.Markdown(
|
56 |
"""
|
57 |
-
##
|
58 |
-
|
59 |
-
- Adjust the blurring strength using the slider.
|
60 |
""")
|
61 |
with gr.Row():
|
62 |
with gr.Column():
|
@@ -75,12 +75,9 @@ with app:
|
|
75 |
gal1=gr.Gallery(type="filepath").style(grid=4)
|
76 |
|
77 |
seg_btn.click(get_seg, inputs=[image_input,object_output], outputs=gal1)
|
78 |
-
|
79 |
|
80 |
-
image_input.change(fn=image_objects,
|
81 |
-
inputs=image_input,
|
82 |
-
outputs=object_output
|
83 |
-
)
|
84 |
|
85 |
|
86 |
|
|
|
27 |
|
28 |
def get_seg(image, object):
|
29 |
image = img_resize(image)
|
30 |
+
pred = model(image)
|
31 |
+
pred_object_list = [str(i)+'_'+x['label'] for i, x in enumerate(pred)]
|
32 |
seg_box=[]
|
33 |
for i in range(len(pred)):
|
34 |
#object_number = int(object.split('_')[0])
|
|
|
44 |
seg_out=segmented_image.astype(np.uint8)
|
45 |
seg_box.append(seg_out)
|
46 |
|
47 |
+
return(seg_box,gr.Dropdown.update(choices = pred_object_list, interactive = True))
|
48 |
+
)
|
49 |
|
50 |
|
51 |
|
|
|
55 |
with app:
|
56 |
gr.Markdown(
|
57 |
"""
|
58 |
+
## Image Dissector
|
59 |
+
|
|
|
60 |
""")
|
61 |
with gr.Row():
|
62 |
with gr.Column():
|
|
|
75 |
gal1=gr.Gallery(type="filepath").style(grid=4)
|
76 |
|
77 |
seg_btn.click(get_seg, inputs=[image_input,object_output], outputs=gal1)
|
78 |
+
image_input.change(get_seg, inputs=[image_input], outputs=[gal1,object_output])
|
79 |
|
80 |
+
#image_input.change(fn=image_objects,inputs=image_input,outputs=object_output)
|
|
|
|
|
|
|
81 |
|
82 |
|
83 |
|