Spaces:
Running
on
Zero
Running
on
Zero
Update vlm_captions.py
Browse files- vlm_captions.py +10 -2
vlm_captions.py
CHANGED
@@ -26,6 +26,8 @@ class VLMCaptioning:
|
|
26 |
top_p: float = 0.9,
|
27 |
top_k: int = 40,
|
28 |
max_new_tokens: int = 512,
|
|
|
|
|
29 |
) -> str:
|
30 |
"""
|
31 |
Generate description for a single image
|
@@ -59,7 +61,9 @@ class VLMCaptioning:
|
|
59 |
temperature=temperature,
|
60 |
top_p=top_p,
|
61 |
top_k=top_k,
|
62 |
-
max_new_tokens=max_new_tokens
|
|
|
|
|
63 |
)
|
64 |
return response
|
65 |
except Exception as e:
|
@@ -74,6 +78,8 @@ class VLMCaptioning:
|
|
74 |
top_p: float = 0.9,
|
75 |
top_k: int = 40,
|
76 |
max_new_tokens: int = 512,
|
|
|
|
|
77 |
) -> str:
|
78 |
"""
|
79 |
Generate description for video frames
|
@@ -113,7 +119,9 @@ class VLMCaptioning:
|
|
113 |
temperature=temperature,
|
114 |
top_p=top_p,
|
115 |
top_k=top_k,
|
116 |
-
max_new_tokens=max_new_tokens
|
|
|
|
|
117 |
)
|
118 |
return response
|
119 |
|
|
|
26 |
top_p: float = 0.9,
|
27 |
top_k: int = 40,
|
28 |
max_new_tokens: int = 512,
|
29 |
+
stream=False,
|
30 |
+
sampling=False
|
31 |
) -> str:
|
32 |
"""
|
33 |
Generate description for a single image
|
|
|
61 |
temperature=temperature,
|
62 |
top_p=top_p,
|
63 |
top_k=top_k,
|
64 |
+
max_new_tokens=max_new_tokens,
|
65 |
+
stream=stream,
|
66 |
+
sampling=sampling
|
67 |
)
|
68 |
return response
|
69 |
except Exception as e:
|
|
|
78 |
top_p: float = 0.9,
|
79 |
top_k: int = 40,
|
80 |
max_new_tokens: int = 512,
|
81 |
+
stream=False,
|
82 |
+
sampling=False
|
83 |
) -> str:
|
84 |
"""
|
85 |
Generate description for video frames
|
|
|
119 |
temperature=temperature,
|
120 |
top_p=top_p,
|
121 |
top_k=top_k,
|
122 |
+
max_new_tokens=max_new_tokens,
|
123 |
+
stream=stream,
|
124 |
+
sampling=sampling
|
125 |
)
|
126 |
return response
|
127 |
|