Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -72,7 +72,8 @@ from sam2.sam2_image_predictor import SAM2ImagePredictor
|
|
72 |
sam2_checkpoint = "sam2_hiera_small.pt"
|
73 |
model_cfg = "sam2_hiera_s.yaml"
|
74 |
|
75 |
-
|
|
|
76 |
predictor = SAM2ImagePredictor(sam2_model)
|
77 |
|
78 |
checkpoint_path = "sam2_lr0.0001_wd0.01_900.torch"
|
|
|
72 |
sam2_checkpoint = "sam2_hiera_small.pt"
|
73 |
model_cfg = "sam2_hiera_s.yaml"
|
74 |
|
75 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
76 |
+
sam2_model = build_sam2(model_cfg, sam2_checkpoint, device=device)
|
77 |
predictor = SAM2ImagePredictor(sam2_model)
|
78 |
|
79 |
checkpoint_path = "sam2_lr0.0001_wd0.01_900.torch"
|