123LETSPLAY commited on
Commit
20f29bf
1 Parent(s): addf261

Create requirements.txt

Browse files
Files changed (1) hide show
  1. requirements.txt +9 -0
requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Use SAM2 with images
2
+ import torch
3
+ from sam2.sam2_image_predictor import SAM2ImagePredictor
4
+
5
+ predictor = SAM2ImagePredictor.from_pretrained(facebook/sam2.1-hiera-large)
6
+
7
+ with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16):
8
+ predictor.set_image(<your_image>)
9
+ masks, _, _ = predictor.predict(<input_prompts>)