Spaces:
Running
on
Zero
Running
on
Zero
handle 0 points
Browse files
app.py
CHANGED
@@ -65,6 +65,10 @@ def load_default_pipeline():
|
|
65 |
@spaces.GPU()
|
66 |
def predict_masks(image, points):
|
67 |
"""Predict a single mask from the image based on selected points."""
|
|
|
|
|
|
|
|
|
68 |
PREDICTOR = SAM2ImagePredictor.from_pretrained(SAM_MODEL, device=DEVICE)
|
69 |
|
70 |
image_np = np.array(image)
|
|
|
65 |
@spaces.GPU()
|
66 |
def predict_masks(image, points):
|
67 |
"""Predict a single mask from the image based on selected points."""
|
68 |
+
|
69 |
+
if not points:
|
70 |
+
return image # Return the original image if no points are selected
|
71 |
+
|
72 |
PREDICTOR = SAM2ImagePredictor.from_pretrained(SAM_MODEL, device=DEVICE)
|
73 |
|
74 |
image_np = np.array(image)
|