nebula commited on
Commit
c4c20fb
1 Parent(s): df0a7d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -5,7 +5,12 @@ import torch
5
  from segment_anything import sam_model_registry
6
  from automatic_mask_generator import SamAutomaticMaskGenerator
7
 
8
- device = 'cuda'
 
 
 
 
 
9
  sam = sam_model_registry['vit_h'](checkpoint='./sam_vit_h_4b8939.pth')
10
  sam.to(device=device)
11
 
 
5
  from segment_anything import sam_model_registry
6
  from automatic_mask_generator import SamAutomaticMaskGenerator
7
 
8
+
9
+ if torch.cuda.is_available():
10
+ device = 'cuda'
11
+ else:
12
+ device = 'cpu'
13
+
14
  sam = sam_model_registry['vit_h'](checkpoint='./sam_vit_h_4b8939.pth')
15
  sam.to(device=device)
16