Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,12 +11,6 @@ from loguru import logger
|
|
| 11 |
|
| 12 |
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
| 13 |
|
| 14 |
-
#if os.environ.get('IS_MY_DEBUG') is None:
|
| 15 |
-
# result = subprocess.run(['pip', 'install', '-e', 'GroundingDINO'], check=True)
|
| 16 |
-
# print(f'pip install GroundingDINO = {result}')
|
| 17 |
-
|
| 18 |
-
# result = subprocess.run(['pip', 'list'], check=True)
|
| 19 |
-
# print(f'pip list = {result}')
|
| 20 |
|
| 21 |
|
| 22 |
import argparse
|
|
@@ -29,20 +23,27 @@ import numpy as np
|
|
| 29 |
import torch
|
| 30 |
from PIL import Image, ImageDraw, ImageFont, ImageOps
|
| 31 |
|
| 32 |
-
# Grounding DINO (the external dependency - we
|
| 33 |
-
import groundingdiny_py.groundingdino.datasets.transforms as T
|
| 34 |
-
from groundingdiny_py.groundingdino.models import build_model
|
| 35 |
-
from groundingdiny_py.groundingdino.util import box_ops
|
| 36 |
-
from groundingdiny_py.groundingdino.util.slconfig import SLConfig
|
| 37 |
-
from groundingdiny_py.groundingdino.util.utils import clean_state_dict, get_phrases_from_posmap
|
| 38 |
-
|
| 39 |
-
# Grounding DINO (the version embedded in the repo - not sure
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
#
|
| 43 |
-
|
| 44 |
-
#
|
| 45 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
import cv2
|
| 48 |
import numpy as np
|
|
|
|
| 11 |
|
| 12 |
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
import argparse
|
|
|
|
| 23 |
import torch
|
| 24 |
from PIL import Image, ImageDraw, ImageFont, ImageOps
|
| 25 |
|
| 26 |
+
# Grounding DINO (the external dependency - shouldn't we use that instead?)
|
| 27 |
+
# import groundingdiny_py.groundingdino.datasets.transforms as T
|
| 28 |
+
# from groundingdiny_py.groundingdino.models import build_model
|
| 29 |
+
# from groundingdiny_py.groundingdino.util import box_ops
|
| 30 |
+
# from groundingdiny_py.groundingdino.util.slconfig import SLConfig
|
| 31 |
+
# from groundingdiny_py.groundingdino.util.utils import clean_state_dict, get_phrases_from_posmap
|
| 32 |
+
|
| 33 |
+
# Grounding DINO (the version embedded in the repo - not sure we should keep this tbh, I would prefer to use a py lib)
|
| 34 |
+
if os.environ.get('IS_MY_DEBUG') is None:
|
| 35 |
+
result = subprocess.run(['pip', 'install', '-e', 'GroundingDINO'], check=True)
|
| 36 |
+
#print(f'pip install GroundingDINO = {result}')
|
| 37 |
+
|
| 38 |
+
#result = subprocess.run(['pip', 'list'], check=True)
|
| 39 |
+
#print(f'pip list = {result}')
|
| 40 |
+
|
| 41 |
+
sys.path.insert(0, './GroundingDINO')
|
| 42 |
+
import GroundingDINO.groundingdino.datasets.transforms as T
|
| 43 |
+
from GroundingDINO.groundingdino.models import build_model
|
| 44 |
+
from GroundingDINO.groundingdino.util import box_ops
|
| 45 |
+
from GroundingDINO.groundingdino.util.slconfig import SLConfig
|
| 46 |
+
from GroundingDINO.groundingdino.util.utils import clean_state_dict, get_phrases_from_posmap
|
| 47 |
|
| 48 |
import cv2
|
| 49 |
import numpy as np
|