Spaces:
Runtime error
Runtime error
add examples
Browse files- app.py +19 -6
- assets/1.jpeg +0 -0
- assets/10.jpeg +0 -0
- assets/11.jpeg +0 -0
- assets/12.jpeg +0 -0
- assets/13.jpeg +0 -0
- assets/14.jpeg +0 -0
- assets/15.jpeg +0 -0
- assets/16.jpeg +0 -0
- assets/2.jpeg +0 -0
- assets/3.jpeg +0 -0
- assets/4.jpeg +0 -0
- assets/5.jpeg +0 -0
- assets/6.jpeg +0 -0
- assets/7.jpeg +0 -0
- assets/8.jpeg +0 -0
- assets/9.jpeg +0 -0
- assets/picture1.jpg +0 -0
- assets/picture2.jpg +0 -0
- assets/picture3.jpg +0 -0
- assets/picture4.jpg +0 -0
app.py
CHANGED
@@ -49,7 +49,7 @@ predictor = SamPredictor(sam)
|
|
49 |
# Description
|
50 |
title = "<center><strong><font size='8'>EdgeSAM<font></strong></center>"
|
51 |
|
52 |
-
description_p = """ # Instructions for point mode [Instructional video](https://huggingface.co/spaces/chongzhou/EdgeSAM/blob/main/assets/point-instructions.mov)
|
53 |
|
54 |
1. Upload an image or click one of the provided examples.
|
55 |
2. Select the point type.
|
@@ -60,7 +60,7 @@ description_p = """ # Instructions for point mode [Instructional video](https://
|
|
60 |
|
61 |
"""
|
62 |
|
63 |
-
description_b = """ # Instructions for box mode [Instructional video](https://huggingface.co/spaces/chongzhou/EdgeSAM/blob/main/assets/box-instructions.mov)
|
64 |
|
65 |
1. Upload an image or click one of the provided examples.
|
66 |
2. Click twice on the image (diagonal points of the box).
|
@@ -77,10 +77,22 @@ description_e = """ # Everything mode is NOT recommended.
|
|
77 |
"""
|
78 |
|
79 |
examples = [
|
80 |
-
["assets/
|
81 |
-
["assets/
|
82 |
-
["assets/
|
83 |
-
["assets/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
]
|
85 |
|
86 |
default_example = examples[0]
|
@@ -473,6 +485,7 @@ with gr.Blocks(css=css, title="EdgeSAM") as demo:
|
|
473 |
reset_btn_p.click(reset, outputs=[cond_img_p, segm_img_p])
|
474 |
tab_p.select(fn=reset_all, outputs=all_outputs)
|
475 |
|
|
|
476 |
cond_img_b.select(get_box_with_draw, [cond_img_b], cond_img_b)
|
477 |
segment_btn_b.click(
|
478 |
segment_with_box, inputs=[cond_img_b], outputs=[cond_img_b, segm_img_b]
|
|
|
49 |
# Description
|
50 |
title = "<center><strong><font size='8'>EdgeSAM<font></strong></center>"
|
51 |
|
52 |
+
description_p = """ # Instructions for point mode [[Instructional video](https://huggingface.co/spaces/chongzhou/EdgeSAM/blob/main/assets/point-instructions.mov)]
|
53 |
|
54 |
1. Upload an image or click one of the provided examples.
|
55 |
2. Select the point type.
|
|
|
60 |
|
61 |
"""
|
62 |
|
63 |
+
description_b = """ # Instructions for box mode [[Instructional video](https://huggingface.co/spaces/chongzhou/EdgeSAM/blob/main/assets/box-instructions.mov)]
|
64 |
|
65 |
1. Upload an image or click one of the provided examples.
|
66 |
2. Click twice on the image (diagonal points of the box).
|
|
|
77 |
"""
|
78 |
|
79 |
examples = [
|
80 |
+
["assets/1.jpeg"],
|
81 |
+
["assets/2.jpeg"],
|
82 |
+
["assets/3.jpeg"],
|
83 |
+
["assets/4.jpeg"],
|
84 |
+
["assets/5.jpeg"],
|
85 |
+
["assets/6.jpeg"],
|
86 |
+
["assets/7.jpeg"],
|
87 |
+
["assets/8.jpeg"],
|
88 |
+
["assets/9.jpeg"],
|
89 |
+
["assets/10.jpeg"],
|
90 |
+
["assets/11.jpeg"],
|
91 |
+
["assets/12.jpeg"],
|
92 |
+
["assets/13.jpeg"],
|
93 |
+
["assets/14.jpeg"],
|
94 |
+
["assets/15.jpeg"],
|
95 |
+
["assets/16.jpeg"]
|
96 |
]
|
97 |
|
98 |
default_example = examples[0]
|
|
|
485 |
reset_btn_p.click(reset, outputs=[cond_img_p, segm_img_p])
|
486 |
tab_p.select(fn=reset_all, outputs=all_outputs)
|
487 |
|
488 |
+
cond_img_b.upload(on_image_upload, cond_img_b, [cond_img_b, segm_img_b])
|
489 |
cond_img_b.select(get_box_with_draw, [cond_img_b], cond_img_b)
|
490 |
segment_btn_b.click(
|
491 |
segment_with_box, inputs=[cond_img_b], outputs=[cond_img_b, segm_img_b]
|
assets/1.jpeg
ADDED
assets/10.jpeg
ADDED
assets/11.jpeg
ADDED
assets/12.jpeg
ADDED
assets/13.jpeg
ADDED
assets/14.jpeg
ADDED
assets/15.jpeg
ADDED
assets/16.jpeg
ADDED
assets/2.jpeg
ADDED
assets/3.jpeg
ADDED
assets/4.jpeg
ADDED
assets/5.jpeg
ADDED
assets/6.jpeg
ADDED
assets/7.jpeg
ADDED
assets/8.jpeg
ADDED
assets/9.jpeg
ADDED
assets/picture1.jpg
DELETED
Binary file (964 kB)
|
|
assets/picture2.jpg
DELETED
Binary file (222 kB)
|
|
assets/picture3.jpg
DELETED
Binary file (376 kB)
|
|
assets/picture4.jpg
DELETED
Binary file (335 kB)
|
|