Spaces:
Runtime error
Runtime error
Satyajithchary
commited on
Commit
•
2b20220
1
Parent(s):
9e8c5c7
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,12 @@
|
|
1 |
pip install --upgrade pip
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
import numpy as np
|
|
|
1 |
pip install --upgrade pip
|
2 |
+
import torch
|
3 |
+
from sam2.sam2_image_predictor import SAM2ImagePredictor
|
4 |
+
|
5 |
+
predictor = SAM2ImagePredictor.from_pretrained("facebook/sam2-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>)
|
10 |
import gradio as gr
|
11 |
import torch
|
12 |
import numpy as np
|