Spaces:
Running
on
Zero
Running
on
Zero
Update minigpt4_video_demo.py
Browse files- minigpt4_video_demo.py +3 -1
minigpt4_video_demo.py
CHANGED
@@ -147,7 +147,7 @@ def generate_subtitles(video_path):
|
|
147 |
print("error",video_path)
|
148 |
return None
|
149 |
|
150 |
-
|
151 |
def run (video_path,instruction,model,vis_processor,gen_subtitles=True):
|
152 |
if gen_subtitles:
|
153 |
subtitle_path=generate_subtitles(video_path)
|
@@ -245,10 +245,12 @@ existed_subtitles={}
|
|
245 |
for sub in os.listdir(inference_subtitles_folder):
|
246 |
existed_subtitles[sub.split('.')[0]]=True
|
247 |
|
|
|
248 |
def gradio_demo_local(video_path,has_sub,instruction):
|
249 |
pred=run(video_path,instruction,model,vis_processor,gen_subtitles=has_sub)
|
250 |
return pred
|
251 |
|
|
|
252 |
def gradio_demo_youtube(youtube_url,has_sub,instruction):
|
253 |
video_path=get_video_url(youtube_url,has_sub)
|
254 |
pred=run(video_path,instruction,model,vis_processor,gen_subtitles=has_sub)
|
|
|
147 |
print("error",video_path)
|
148 |
return None
|
149 |
|
150 |
+
|
151 |
def run (video_path,instruction,model,vis_processor,gen_subtitles=True):
|
152 |
if gen_subtitles:
|
153 |
subtitle_path=generate_subtitles(video_path)
|
|
|
245 |
for sub in os.listdir(inference_subtitles_folder):
|
246 |
existed_subtitles[sub.split('.')[0]]=True
|
247 |
|
248 |
+
@spaces.GPU()
|
249 |
def gradio_demo_local(video_path,has_sub,instruction):
|
250 |
pred=run(video_path,instruction,model,vis_processor,gen_subtitles=has_sub)
|
251 |
return pred
|
252 |
|
253 |
+
@spaces.GPU()
|
254 |
def gradio_demo_youtube(youtube_url,has_sub,instruction):
|
255 |
video_path=get_video_url(youtube_url,has_sub)
|
256 |
pred=run(video_path,instruction,model,vis_processor,gen_subtitles=has_sub)
|