Spaces:
Running
on
Zero
Running
on
Zero
fix
Browse files
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)
|