LPX55 commited on
Commit
add180f
·
1 Parent(s): 7358664
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -14,7 +14,6 @@ from sam2.sam2_image_predictor import SAM2ImagePredictor
14
 
15
  DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
16
  SAM_MODEL = "facebook/sam2.1-hiera-large"
17
- PREDICTOR = SAM2ImagePredictor.from_pretrained(SAM_MODEL, device=DEVICE)
18
 
19
  MODELS = {
20
  "RealVisXL V5.0 Lightning": "SG161222/RealVisXL_V5.0_Lightning",
@@ -66,7 +65,8 @@ def load_default_pipeline():
66
  @spaces.GPU()
67
  def predict_masks(image, points):
68
  """Predict a single mask from the image based on selected points."""
69
-
 
70
  image_np = np.array(image)
71
  points_list = [[point["x"], point["y"]] for point in points]
72
  input_labels = [1] * len(points_list)
 
14
 
15
  DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
16
  SAM_MODEL = "facebook/sam2.1-hiera-large"
 
17
 
18
  MODELS = {
19
  "RealVisXL V5.0 Lightning": "SG161222/RealVisXL_V5.0_Lightning",
 
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)
71
  points_list = [[point["x"], point["y"]] for point in points]
72
  input_labels = [1] * len(points_list)