jbilcke-hf commited on
Commit
d0c50ce
·
verified ·
1 Parent(s): 26caaeb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -8
app.py CHANGED
@@ -18,7 +18,6 @@ os.environ["CUDA_VISIBLE_DEVICES"] = "0"
18
  # result = subprocess.run(['pip', 'list'], check=True)
19
  # print(f'pip list = {result}')
20
 
21
- sys.path.insert(0, './GroundingDINO')
22
 
23
  import argparse
24
  import copy
@@ -30,12 +29,20 @@ import numpy as np
30
  import torch
31
  from PIL import Image, ImageDraw, ImageFont, ImageOps
32
 
33
- # Grounding DINO
34
- import GroundingDINO.groundingdino.datasets.transforms as T
35
- from GroundingDINO.groundingdino.models import build_model
36
- from GroundingDINO.groundingdino.util import box_ops
37
- from GroundingDINO.groundingdino.util.slconfig import SLConfig
38
- from GroundingDINO.groundingdino.util.utils import clean_state_dict, get_phrases_from_posmap
 
 
 
 
 
 
 
 
39
 
40
  import cv2
41
  import numpy as np
@@ -647,7 +654,6 @@ if __name__ == "__main__":
647
  <p style="color: black;">Interested in using it? Please use the <a href="https://huggingface.co/spaces/yizhangliu/Grounded-Segment-Anything" target="_blank">original space</a>, thank you!</p>
648
  </div>
649
  </div>""")
650
- with gr.Row():
651
 
652
  secret_token = gr.Textbox()
653
  text_prompt = gr.Textbox()
 
18
  # result = subprocess.run(['pip', 'list'], check=True)
19
  # print(f'pip list = {result}')
20
 
 
21
 
22
  import argparse
23
  import copy
 
29
  import torch
30
  from PIL import Image, ImageDraw, ImageFont, ImageOps
31
 
32
+ # Grounding DINO (the external dependency - we should use that, it's better)
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 why the author felt the need to use that)
40
+ # sys.path.insert(0, './GroundingDINO')
41
+ #import GroundingDINO.groundingdino.datasets.transforms as T
42
+ #from GroundingDINO.groundingdino.models import build_model
43
+ #from GroundingDINO.groundingdino.util import box_ops
44
+ #from GroundingDINO.groundingdino.util.slconfig import SLConfig
45
+ #from GroundingDINO.groundingdino.util.utils import clean_state_dict, get_phrases_from_posmap
46
 
47
  import cv2
48
  import numpy as np
 
654
  <p style="color: black;">Interested in using it? Please use the <a href="https://huggingface.co/spaces/yizhangliu/Grounded-Segment-Anything" target="_blank">original space</a>, thank you!</p>
655
  </div>
656
  </div>""")
 
657
 
658
  secret_token = gr.Textbox()
659
  text_prompt = gr.Textbox()