Spaces:
Runtime error
Runtime error
Update minigpt4_video_demo.py
Browse files- minigpt4_video_demo.py +11 -2
minigpt4_video_demo.py
CHANGED
@@ -17,10 +17,19 @@ from PIL import Image
|
|
17 |
from moviepy.editor import VideoFileClip
|
18 |
from theme import minigptlv_style, custom_css,text_css
|
19 |
|
20 |
-
from huggingface_hub import login
|
21 |
hf_token = os.environ.get('HF_TKN')
|
22 |
login(token=hf_token)
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
def create_video_grid(images, rows, cols,save_path):
|
25 |
image_width, image_height = images[0].size
|
26 |
grid_width = cols * image_width
|
@@ -132,7 +141,7 @@ def generate_subtitles(video_path):
|
|
132 |
print("error",video_path)
|
133 |
return None
|
134 |
|
135 |
-
|
136 |
def run (video_path,instruction,model,vis_processor,gen_subtitles=True):
|
137 |
if gen_subtitles:
|
138 |
subtitle_path=generate_subtitles(video_path)
|
|
|
17 |
from moviepy.editor import VideoFileClip
|
18 |
from theme import minigptlv_style, custom_css,text_css
|
19 |
|
20 |
+
from huggingface_hub import login, hf_hub_download
|
21 |
hf_token = os.environ.get('HF_TKN')
|
22 |
login(token=hf_token)
|
23 |
|
24 |
+
hf_hub_download(
|
25 |
+
repo_id='Vision-CAIR/MiniGPT4-Video',
|
26 |
+
filename='video_llama_checkpoint_last.pth',
|
27 |
+
local_dir='checkpoints',
|
28 |
+
local_dir_use_symlinks=False,
|
29 |
+
)
|
30 |
+
|
31 |
+
import spaces
|
32 |
+
|
33 |
def create_video_grid(images, rows, cols,save_path):
|
34 |
image_width, image_height = images[0].size
|
35 |
grid_width = cols * image_width
|
|
|
141 |
print("error",video_path)
|
142 |
return None
|
143 |
|
144 |
+
@spaces.GPU()
|
145 |
def run (video_path,instruction,model,vis_processor,gen_subtitles=True):
|
146 |
if gen_subtitles:
|
147 |
subtitle_path=generate_subtitles(video_path)
|