LPX55 commited on
Commit
6bc4886
·
1 Parent(s): 97af200
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -65,6 +65,8 @@ 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
  image_np = np.array(image)
69
  points_list = [[point["x"], point["y"]] for point in points]
70
  input_labels = [1] * len(points_list)
 
65
  @spaces.GPU()
66
  def predict_masks(image, points):
67
  """Predict a single mask from the image based on selected points."""
68
+ global PREDICTOR
69
+ PREDICTOR = SAM2ImagePredictor.from_pretrained(SAM_MODEL, device=DEVICE)
70
  image_np = np.array(image)
71
  points_list = [[point["x"], point["y"]] for point in points]
72
  input_labels = [1] * len(points_list)