nielsr HF staff commited on
Commit
e34711c
1 Parent(s): e6ad8cd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -3
README.md CHANGED
@@ -5,18 +5,28 @@ pipeline_tag: mask-generation
5
 
6
  This model repository contains the weights of the MobileSAM model.
7
 
 
 
 
 
8
  ## Usage
9
 
10
- The model can be used as follows:
11
 
12
- ```python
13
- !pip install git+https://github.com/ChaoningZhang/MobileSAM.git
 
14
 
 
 
 
15
  from mobile_sam import MobileSAM, SamPredictor
 
16
 
17
  model = MobileSAM.from_pretrained("nielsr/mobilesam")
18
 
19
  # perform inference
 
20
  model.to(device=device)
21
 
22
  predictor = SamPredictor(model)
 
5
 
6
  This model repository contains the weights of the MobileSAM model.
7
 
8
+ ## Installation
9
+
10
+ First install the M
11
+
12
  ## Usage
13
 
14
+ First install the MobileSAM package:
15
 
16
+ ```bash
17
+ pip install git+https://github.com/ChaoningZhang/MobileSAM.git
18
+ ```
19
 
20
+ The model can then be used as follows:
21
+
22
+ ```python
23
  from mobile_sam import MobileSAM, SamPredictor
24
+ import torch
25
 
26
  model = MobileSAM.from_pretrained("nielsr/mobilesam")
27
 
28
  # perform inference
29
+ device = "cuda" if torch.cuda.is_available() else "cpu"
30
  model.to(device=device)
31
 
32
  predictor = SamPredictor(model)