Spaces:
Paused
Paused
spaces
Browse files
app.py
CHANGED
|
@@ -6,8 +6,8 @@ import contextlib
|
|
| 6 |
import io
|
| 7 |
import traceback
|
| 8 |
import gradio as gr
|
|
|
|
| 9 |
from transformers import AutoModel, AutoTokenizer, AutoConfig, pipeline
|
| 10 |
-
|
| 11 |
from huggingface_hub import snapshot_download
|
| 12 |
import sys, pathlib
|
| 13 |
import os
|
|
@@ -52,6 +52,7 @@ gd_config_path = "//" + str(current_dir / "GroundingDINO_SwinT_OGC.py")
|
|
| 52 |
gd_checkpoint_path = "//" + str(current_dir / "groundingdino_swint_ogc.pth")
|
| 53 |
visualization_dir = "//" + str(current_dir / "outputs")
|
| 54 |
|
|
|
|
| 55 |
def process_video(video_file, categorical_keywords, unary_keywords, binary_keywords, object_pairs, output_fps):
|
| 56 |
log_buffer = io.StringIO()
|
| 57 |
try:
|
|
@@ -143,4 +144,12 @@ demo = gr.Interface(
|
|
| 143 |
)
|
| 144 |
|
| 145 |
if __name__ == "__main__":
|
| 146 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
import io
|
| 7 |
import traceback
|
| 8 |
import gradio as gr
|
| 9 |
+
import spaces
|
| 10 |
from transformers import AutoModel, AutoTokenizer, AutoConfig, pipeline
|
|
|
|
| 11 |
from huggingface_hub import snapshot_download
|
| 12 |
import sys, pathlib
|
| 13 |
import os
|
|
|
|
| 52 |
gd_checkpoint_path = "//" + str(current_dir / "groundingdino_swint_ogc.pth")
|
| 53 |
visualization_dir = "//" + str(current_dir / "outputs")
|
| 54 |
|
| 55 |
+
@spaces.GPU(duration=200)
|
| 56 |
def process_video(video_file, categorical_keywords, unary_keywords, binary_keywords, object_pairs, output_fps):
|
| 57 |
log_buffer = io.StringIO()
|
| 58 |
try:
|
|
|
|
| 144 |
)
|
| 145 |
|
| 146 |
if __name__ == "__main__":
|
| 147 |
+
demo.launch()
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
#input would be video file path and keywords
|
| 155 |
+
#out would be video, efforts
|