LPX55 commited on
Commit
5a9b472
·
1 Parent(s): add180f

handle 0 points

Browse files
Files changed (1) hide show
  1. app.py +4 -0
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)