Spaces:
Running
on
Zero
Running
on
Zero
eh
Browse files
app.py
CHANGED
@@ -14,7 +14,8 @@ 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 =
|
|
|
18 |
MODELS = {
|
19 |
"RealVisXL V5.0 Lightning": "SG161222/RealVisXL_V5.0_Lightning",
|
20 |
"Lustify Lightning": "GraydientPlatformAPI/lustify-lightning",
|
@@ -65,8 +66,7 @@ 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 |
-
|
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)
|
|
|
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",
|
21 |
"Lustify Lightning": "GraydientPlatformAPI/lustify-lightning",
|
|
|
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)
|