Spaces:
Runtime error
Runtime error
liuyizhang
commited on
Commit
•
abcd303
1
Parent(s):
1143c62
update app.py
Browse files
app.py
CHANGED
@@ -14,8 +14,8 @@ if os.environ.get('IS_MY_DEBUG') is None:
|
|
14 |
result = subprocess.run(['pip', 'install', '-e', 'GroundingDINO'], check=True)
|
15 |
print(f'pip install GroundingDINO = {result}')
|
16 |
|
17 |
-
result = subprocess.run(['pip', 'list'], check=True)
|
18 |
-
print(f'pip list = {result}')
|
19 |
|
20 |
sys.path.insert(0, './GroundingDINO')
|
21 |
|
@@ -72,6 +72,7 @@ device = 'cpu'
|
|
72 |
|
73 |
os.makedirs(output_dir, exist_ok=True)
|
74 |
groundingdino_model = None
|
|
|
75 |
sam_model = None
|
76 |
sam_predictor = None
|
77 |
sam_mask_generator = None
|
@@ -256,7 +257,7 @@ def load_groundingdino_model():
|
|
256 |
|
257 |
def load_sam_model():
|
258 |
# initialize SAM
|
259 |
-
global sam_model, sam_predictor, sam_mask_generator
|
260 |
logger.info(f"initialize SAM model...")
|
261 |
sam_device = device
|
262 |
sam_model = build_sam(checkpoint=sam_checkpoint).to(sam_device)
|
|
|
14 |
result = subprocess.run(['pip', 'install', '-e', 'GroundingDINO'], check=True)
|
15 |
print(f'pip install GroundingDINO = {result}')
|
16 |
|
17 |
+
# result = subprocess.run(['pip', 'list'], check=True)
|
18 |
+
# print(f'pip list = {result}')
|
19 |
|
20 |
sys.path.insert(0, './GroundingDINO')
|
21 |
|
|
|
72 |
|
73 |
os.makedirs(output_dir, exist_ok=True)
|
74 |
groundingdino_model = None
|
75 |
+
sam_device = None
|
76 |
sam_model = None
|
77 |
sam_predictor = None
|
78 |
sam_mask_generator = None
|
|
|
257 |
|
258 |
def load_sam_model():
|
259 |
# initialize SAM
|
260 |
+
global sam_model, sam_predictor, sam_mask_generator, sam_device
|
261 |
logger.info(f"initialize SAM model...")
|
262 |
sam_device = device
|
263 |
sam_model = build_sam(checkpoint=sam_checkpoint).to(sam_device)
|