ybhavsar2009 commited on
Commit
1a0610b
·
verified ·
1 Parent(s): f034c52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
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
- sam2_model = build_sam2(model_cfg, sam2_checkpoint, device="cuda")
 
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"