Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,11 +12,10 @@ from segment_anything import SamAutomaticMaskGenerator, SamPredictor, sam_model_
|
|
12 |
|
13 |
matplotlib.pyplot.switch_backend('Agg') # for matplotlib to work in gradio
|
14 |
|
15 |
-
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # use GPU if available
|
16 |
|
17 |
#setup model
|
18 |
sam_checkpoint = "sam_vit_h_4b8939.pth"
|
19 |
-
device =
|
20 |
model_type = "default"
|
21 |
sam = sam_model_registry[model_type](checkpoint=sam_checkpoint)
|
22 |
sam.to(device=device)
|
|
|
12 |
|
13 |
matplotlib.pyplot.switch_backend('Agg') # for matplotlib to work in gradio
|
14 |
|
|
|
15 |
|
16 |
#setup model
|
17 |
sam_checkpoint = "sam_vit_h_4b8939.pth"
|
18 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # use GPU if available
|
19 |
model_type = "default"
|
20 |
sam = sam_model_registry[model_type](checkpoint=sam_checkpoint)
|
21 |
sam.to(device=device)
|