Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
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 |
|