Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -36,6 +36,16 @@ sys.path.append(os.path.join(os.path.dirname(__file__), 'SAM2'))
|
|
36 |
torch.backends.cuda.matmul.allow_tf32 = True # for gpu >= Ampere and pytorch >= 1.12
|
37 |
batch_size = 1
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
########################## 引入grounding_dino #############################
|
40 |
from transformers import AutoProcessor, AutoModelForZeroShotObjectDetection
|
41 |
def get_mask_from_grounding_dino(video_dir, ann_frame_idx, ann_obj_id, input_text):
|
|
|
36 |
torch.backends.cuda.matmul.allow_tf32 = True # for gpu >= Ampere and pytorch >= 1.12
|
37 |
batch_size = 1
|
38 |
|
39 |
+
|
40 |
+
|
41 |
+
import subprocess
|
42 |
+
import sys
|
43 |
+
# 先构建扩展模块
|
44 |
+
subprocess.check_call([sys.executable, "setup.py", "build_ext", "--inplace"])
|
45 |
+
# 安装项目到开发模式
|
46 |
+
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-e', '.'])
|
47 |
+
|
48 |
+
|
49 |
########################## 引入grounding_dino #############################
|
50 |
from transformers import AutoProcessor, AutoModelForZeroShotObjectDetection
|
51 |
def get_mask_from_grounding_dino(video_dir, ann_frame_idx, ann_obj_id, input_text):
|