annading commited on
Commit
80eb764
1 Parent(s): 4785a21
Files changed (2) hide show
  1. app.py +11 -8
  2. baboon_15s.mp4 +3 -0
app.py CHANGED
@@ -1,8 +1,11 @@
1
  import subprocess
2
  import os
 
3
  # set CUDA_HOME
4
  os.environ["CUDA_HOME"] = "/usr/local/cuda-11.8/"
5
  subprocess.run(['pip', 'install', '-e', 'GroundingDINO'])
 
 
6
  os.system("wget https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/groundingdino_swint_ogc.pth")
7
  os.system("wget https://huggingface.co/spaces/mrtlive/segment-anything-model/resolve/main/sam_vit_h_4b8939.pth")
8
 
@@ -84,13 +87,13 @@ with gr.Blocks() as demo:
84
  run_btn.click(fn=run_sam_dino, inputs=[input, grounding_caption, box_threshold, text_threshold, fps_processed, video_options], outputs=[vid])
85
  vid.change(fn=vid_download, outputs=download_file)
86
 
87
- # gr.Examples(
88
- # [["baboon_15s.mp4", "baboon", 0.25, 0.25, 1, ["Bounding boxes", "Masks"]]],
89
- # inputs = [input, grounding_caption, box_threshold, text_threshold, fps_processed, video_options],
90
- # outputs = [vid],
91
- # fn=run_sam_dino,
92
- # cache_examples=True,
93
- # label='Example'
94
- # )
95
 
96
  demo.launch(share=False)
 
1
  import subprocess
2
  import os
3
+ import sys
4
  # set CUDA_HOME
5
  os.environ["CUDA_HOME"] = "/usr/local/cuda-11.8/"
6
  subprocess.run(['pip', 'install', '-e', 'GroundingDINO'])
7
+ sys.path.append(os.path.join(os.getcwd(), "GroundingDINO"))
8
+ sys.path.append(os.path.join(os.getcwd(), "segment_anything"))
9
  os.system("wget https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/groundingdino_swint_ogc.pth")
10
  os.system("wget https://huggingface.co/spaces/mrtlive/segment-anything-model/resolve/main/sam_vit_h_4b8939.pth")
11
 
 
87
  run_btn.click(fn=run_sam_dino, inputs=[input, grounding_caption, box_threshold, text_threshold, fps_processed, video_options], outputs=[vid])
88
  vid.change(fn=vid_download, outputs=download_file)
89
 
90
+ gr.Examples(
91
+ [["baboon_15s.mp4", "baboon", 0.25, 0.25, 1, ["Bounding boxes", "Masks"]]],
92
+ inputs = [input, grounding_caption, box_threshold, text_threshold, fps_processed, video_options],
93
+ outputs = [vid],
94
+ fn=run_sam_dino,
95
+ cache_examples=True,
96
+ label='Example'
97
+ )
98
 
99
  demo.launch(share=False)
baboon_15s.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:60b6845667e7a62685ee91a0cbea5e9d624c8637d564bde2690ac8f86bf77729
3
+ size 19019436