Spaces:
Build error
Build error
123LETSPLAY
commited on
Create requirements.txt
Browse files- 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>)
|