Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -12,10 +12,9 @@ from loguru import logger
|
|
12 |
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
13 |
os.system("pip list")
|
14 |
|
15 |
-
if os.environ.get('IS_MY_DEBUG') is None:
|
16 |
-
|
17 |
-
|
18 |
-
# logger.info(f'pip install GroundingDINO = {result}')
|
19 |
|
20 |
logger.info(f"Start app...")
|
21 |
os.system("pip list")
|
@@ -31,13 +30,16 @@ import numpy as np
|
|
31 |
import torch
|
32 |
from PIL import Image, ImageDraw, ImageFont, ImageOps
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
from GroundingDINO.groundingdino.
|
38 |
-
from GroundingDINO.groundingdino.util
|
39 |
-
from GroundingDINO.groundingdino.util.
|
40 |
-
|
|
|
|
|
|
|
41 |
import cv2
|
42 |
import numpy as np
|
43 |
import matplotlib
|
|
|
12 |
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
13 |
os.system("pip list")
|
14 |
|
15 |
+
# if os.environ.get('IS_MY_DEBUG') is None:
|
16 |
+
# result = subprocess.run(['pip', 'install', '-e', 'GroundingDINO'], check=True)
|
17 |
+
# logger.info(f'pip install GroundingDINO = {result}')
|
|
|
18 |
|
19 |
logger.info(f"Start app...")
|
20 |
os.system("pip list")
|
|
|
30 |
import torch
|
31 |
from PIL import Image, ImageDraw, ImageFont, ImageOps
|
32 |
|
33 |
+
try:
|
34 |
+
# Grounding DINO
|
35 |
+
import GroundingDINO.groundingdino.datasets.transforms as T
|
36 |
+
from GroundingDINO.groundingdino.models import build_model
|
37 |
+
from GroundingDINO.groundingdino.util import box_ops
|
38 |
+
from GroundingDINO.groundingdino.util.slconfig import SLConfig
|
39 |
+
from GroundingDINO.groundingdino.util.utils import clean_state_dict, get_phrases_from_posmap
|
40 |
+
except Exception as e:
|
41 |
+
logger.error(f"import GroundingDINO error: {str(e)}")
|
42 |
+
|
43 |
import cv2
|
44 |
import numpy as np
|
45 |
import matplotlib
|