Spaces:
Runtime error
Runtime error
app.py
CHANGED
@@ -19,16 +19,18 @@ def mkstemp(suffix, dir=None):
|
|
19 |
return Path(path)
|
20 |
|
21 |
|
22 |
-
def get_sam_feat(img):
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
|
27 |
|
28 |
def get_masked_img(img, w, h):
|
29 |
point_coords = [w, h]
|
30 |
point_labels = [1]
|
31 |
dilate_kernel_size = 15
|
|
|
|
|
32 |
# masks, _, _ = predictor.predict(
|
33 |
masks, _, _ = model['sam'].predict(
|
34 |
point_coords=np.array([point_coords]),
|
@@ -143,7 +145,7 @@ with gr.Blocks() as demo:
|
|
143 |
# [img],
|
144 |
# []
|
145 |
# )
|
146 |
-
img.change(get_sam_feat, [img], [])
|
147 |
sam_mask.click(
|
148 |
get_masked_img,
|
149 |
[img, w, h],
|
|
|
19 |
return Path(path)
|
20 |
|
21 |
|
22 |
+
# def get_sam_feat(img):
|
23 |
+
# # predictor.set_image(img)
|
24 |
+
# model['sam'].set_image(img)
|
25 |
+
# return
|
26 |
|
27 |
|
28 |
def get_masked_img(img, w, h):
|
29 |
point_coords = [w, h]
|
30 |
point_labels = [1]
|
31 |
dilate_kernel_size = 15
|
32 |
+
|
33 |
+
model['sam'].set_image(img)
|
34 |
# masks, _, _ = predictor.predict(
|
35 |
masks, _, _ = model['sam'].predict(
|
36 |
point_coords=np.array([point_coords]),
|
|
|
145 |
# [img],
|
146 |
# []
|
147 |
# )
|
148 |
+
# img.change(get_sam_feat, [img], [])
|
149 |
sam_mask.click(
|
150 |
get_masked_img,
|
151 |
[img, w, h],
|