sumit-ai-ml commited on
Commit
057f3bb
·
1 Parent(s): 368df72

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -44,11 +44,14 @@ def segment_image(input_image, selected_model):
44
  for result in results:
45
  boxes = result.boxes
46
  bbox = boxes.xyxy.tolist()[0]
47
-
48
- sam_checkpoint = "medsam_vit_b.pth"
49
- model_type = "vit_b"
50
- sam = sam_model_registry[model_type](checkpoint=sam_checkpoint)
51
- sam.to(device='cpu')
 
 
 
52
  predictor = SamPredictor(sam)
53
  predictor.set_image(img)
54
 
 
44
  for result in results:
45
  boxes = result.boxes
46
  bbox = boxes.xyxy.tolist()[0]
47
+ sam_checkpoint = "sam_vit_h_4b8939.pth"
48
+ model_type = "vit_h"
49
+ sam = sam_model_registry[model_type](checkpoint=sam_checkpoint, map_location=torch.device('cpu'))
50
+
51
+ #sam_checkpoint = "medsam_vit_b.pth"
52
+ #model_type = "vit_b"
53
+ #sam = sam_model_registry[model_type](checkpoint=sam_checkpoint)
54
+ #sam.to(device='cpu')
55
  predictor = SamPredictor(sam)
56
  predictor.set_image(img)
57