Spaces:
Runtime error
Runtime error
initial commit
Browse files
app.py
CHANGED
@@ -1,18 +1,22 @@
|
|
1 |
-
import shlex
|
2 |
import subprocess
|
|
|
|
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
"git clone https://github.com/facebookresearch/segment-anything-2.git && cd segment-anything-2 && pip install -e ."
|
7 |
-
)
|
8 |
-
)
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
from sam2.sam2_image_predictor import SAM2ImagePredictor
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
CONFIG = "sam2_hiera_l.yaml"
|
17 |
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import subprocess
|
2 |
+
import shlex
|
3 |
+
import os
|
4 |
|
5 |
+
# Clone the repository
|
6 |
+
subprocess.run(shlex.split("git clone https://github.com/facebookresearch/segment-anything-2.git"))
|
|
|
|
|
|
|
7 |
|
8 |
+
# Change to the repository directory
|
9 |
+
os.chdir("segment-anything-2")
|
|
|
10 |
|
11 |
+
# Install the package
|
12 |
+
subprocess.run(shlex.split("pip install -e ."))
|
|
|
13 |
|
14 |
+
# import torch
|
15 |
+
# from sam2.build_sam import build_sam2
|
16 |
+
# from sam2.sam2_image_predictor import SAM2ImagePredictor
|
17 |
+
#
|
18 |
+
# DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
19 |
+
# CHECKPOINT = f"checkpoints/sam2_hiera_large.pt"
|
20 |
+
# CONFIG = "sam2_hiera_l.yaml"
|
21 |
+
#
|
22 |
+
# sam2_model = build_sam2(CONFIG, CHECKPOINT, device=DEVICE)
|