Spaces:
Running
on
T4
Running
on
T4
xinghaochen
commited on
Commit
•
5236358
1
Parent(s):
2cf356e
Update app.py
Browse files
app.py
CHANGED
@@ -16,6 +16,8 @@ from huggingface_hub import snapshot_download
|
|
16 |
|
17 |
|
18 |
#snapshot_download("merve/tinysam", local_dir="tinysam")
|
|
|
|
|
19 |
|
20 |
model_type = "vit_t"
|
21 |
sam = sam_model_registry[model_type](checkpoint="./tinysam.pth")
|
@@ -214,7 +216,7 @@ def get_points_with_draw(image, cond_image, global_points, global_point_label, e
|
|
214 |
image = copy.deepcopy(cond_image)
|
215 |
x, y = evt.index[0], evt.index[1]
|
216 |
label = "Add Mask"
|
217 |
-
point_radius, point_color =
|
218 |
255,
|
219 |
0,
|
220 |
255,
|
@@ -242,7 +244,7 @@ def get_points_with_draw_(image, cond_image, global_points, global_point_label,
|
|
242 |
return image, global_points, global_point_label
|
243 |
x, y = evt.index[0], evt.index[1]
|
244 |
label = "Add Mask"
|
245 |
-
point_radius, point_color =
|
246 |
255,
|
247 |
0,
|
248 |
255,
|
|
|
16 |
|
17 |
|
18 |
#snapshot_download("merve/tinysam", local_dir="tinysam")
|
19 |
+
URL = "https://github.com/xinghaochen/TinySAM/releases/download/1.0/tinysam.pth"
|
20 |
+
response = wget.download(URL, "tinysam.pth")
|
21 |
|
22 |
model_type = "vit_t"
|
23 |
sam = sam_model_registry[model_type](checkpoint="./tinysam.pth")
|
|
|
216 |
image = copy.deepcopy(cond_image)
|
217 |
x, y = evt.index[0], evt.index[1]
|
218 |
label = "Add Mask"
|
219 |
+
point_radius, point_color = 8, (255, 255, 0) if label == "Add Mask" else (
|
220 |
255,
|
221 |
0,
|
222 |
255,
|
|
|
244 |
return image, global_points, global_point_label
|
245 |
x, y = evt.index[0], evt.index[1]
|
246 |
label = "Add Mask"
|
247 |
+
point_radius, point_color = 8, (255, 255, 0) if label == "Add Mask" else (
|
248 |
255,
|
249 |
0,
|
250 |
255,
|