Spaces:
Runtime error
Runtime error
Fix multiple point error
Browse files
app.py
CHANGED
@@ -103,20 +103,20 @@ def segment_with_points(
|
|
103 |
image = image.resize((new_w, new_h))
|
104 |
|
105 |
scaled_points = np.array([[int(x * scale) for x in point] for point in global_points])
|
106 |
-
|
107 |
|
108 |
nd_image = np.array(image)
|
109 |
predictor.set_image(nd_image)
|
110 |
masks, scores, logits = predictor.predict(
|
111 |
point_coords=scaled_points,
|
112 |
-
point_labels=
|
113 |
multimask_output=True,
|
114 |
)
|
115 |
|
116 |
results = format_results(masks, scores, logits, 0)
|
117 |
|
118 |
annotations, _ = point_prompt(
|
119 |
-
results, scaled_points,
|
120 |
)
|
121 |
annotations = np.array([annotations])
|
122 |
|
|
|
103 |
image = image.resize((new_w, new_h))
|
104 |
|
105 |
scaled_points = np.array([[int(x * scale) for x in point] for point in global_points])
|
106 |
+
scaled_point_label = np.array(global_point_label)
|
107 |
|
108 |
nd_image = np.array(image)
|
109 |
predictor.set_image(nd_image)
|
110 |
masks, scores, logits = predictor.predict(
|
111 |
point_coords=scaled_points,
|
112 |
+
point_labels=scaled_point_label,
|
113 |
multimask_output=True,
|
114 |
)
|
115 |
|
116 |
results = format_results(masks, scores, logits, 0)
|
117 |
|
118 |
annotations, _ = point_prompt(
|
119 |
+
results, scaled_points, scaled_point_label, new_h, new_w
|
120 |
)
|
121 |
annotations = np.array([annotations])
|
122 |
|