Aliayub1995
commited on
Commit
•
7095ee5
1
Parent(s):
a0a5594
Update videollama2/__init__.py
Browse files- videollama2/__init__.py +4 -2
videollama2/__init__.py
CHANGED
@@ -3,6 +3,7 @@ import copy
|
|
3 |
import warnings
|
4 |
import shutil
|
5 |
from functools import partial
|
|
|
6 |
|
7 |
import torch
|
8 |
import logging
|
@@ -32,7 +33,7 @@ def model_init(model_path=None, **kwargs):
|
|
32 |
return model, processor, tokenizer
|
33 |
|
34 |
|
35 |
-
def mm_infer(
|
36 |
"""inference api of VideoLLaMA2 for video understanding.
|
37 |
|
38 |
Args:
|
@@ -45,7 +46,8 @@ def mm_infer(image_or_video, instruct, model, tokenizer, modal='video', **kwargs
|
|
45 |
Returns:
|
46 |
str: response of the model.
|
47 |
"""
|
48 |
-
|
|
|
49 |
# 1. text preprocess (tag process & generate prompt).
|
50 |
if modal == 'image':
|
51 |
modal_token = DEFAULT_IMAGE_TOKEN
|
|
|
3 |
import warnings
|
4 |
import shutil
|
5 |
from functools import partial
|
6 |
+
import gdown
|
7 |
|
8 |
import torch
|
9 |
import logging
|
|
|
33 |
return model, processor, tokenizer
|
34 |
|
35 |
|
36 |
+
def mm_infer(url, instruct, model, tokenizer, modal='video', **kwargs):
|
37 |
"""inference api of VideoLLaMA2 for video understanding.
|
38 |
|
39 |
Args:
|
|
|
46 |
Returns:
|
47 |
str: response of the model.
|
48 |
"""
|
49 |
+
image_or_video = 'Temp.mp4'
|
50 |
+
gdown.download(url, output, quiet=False)
|
51 |
# 1. text preprocess (tag process & generate prompt).
|
52 |
if modal == 'image':
|
53 |
modal_token = DEFAULT_IMAGE_TOKEN
|