Spaces:
Running
Running
Update chatbot.py
Browse files- chatbot.py +2 -2
chatbot.py
CHANGED
@@ -262,13 +262,13 @@ def model_inference(
|
|
262 |
img = user_prompt["files"]
|
263 |
ext_buffer =f"'user\ntext': '{txt}', 'files': '{img}' assistant"
|
264 |
|
265 |
-
video_extensions = ("avi", "mp4", "mov", "mkv", "flv", "wmv", "mjpeg")
|
266 |
image_extensions = Image.registered_extensions()
|
267 |
image_extensions = tuple([ex for ex, f in image_extensions.items()])
|
268 |
|
269 |
if image.endswith(video_extensions):
|
270 |
image = sample_frames(image, 12)
|
271 |
-
image_tokens = "<image>" *
|
272 |
prompt = f"<|im_start|>user {image_tokens}\n{user_prompt}<|im_end|><|im_start|>assistant"
|
273 |
|
274 |
elif image.endswith(image_extensions):
|
|
|
262 |
img = user_prompt["files"]
|
263 |
ext_buffer =f"'user\ntext': '{txt}', 'files': '{img}' assistant"
|
264 |
|
265 |
+
video_extensions = ("avi", "mp4", "mov", "mkv", "flv", "wmv", "mjpeg", "wav", "gif", "webm", "m4v", "3gp")
|
266 |
image_extensions = Image.registered_extensions()
|
267 |
image_extensions = tuple([ex for ex, f in image_extensions.items()])
|
268 |
|
269 |
if image.endswith(video_extensions):
|
270 |
image = sample_frames(image, 12)
|
271 |
+
image_tokens = "<image>" * int(len(image))
|
272 |
prompt = f"<|im_start|>user {image_tokens}\n{user_prompt}<|im_end|><|im_start|>assistant"
|
273 |
|
274 |
elif image.endswith(image_extensions):
|