Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -411,7 +411,9 @@ def bot(history, temperature, top_p, max_output_tokens):
|
|
411 |
dst.write(src.read())
|
412 |
|
413 |
image_tensor = []
|
414 |
-
if
|
|
|
|
|
415 |
image_tensor = [
|
416 |
our_chatbot.image_processor.preprocess(f, return_tensors="pt")["pixel_values"][
|
417 |
0
|
@@ -421,9 +423,6 @@ def bot(history, temperature, top_p, max_output_tokens):
|
|
421 |
for f in image_list
|
422 |
]
|
423 |
image_tensor = torch.stack(image_tensor)
|
424 |
-
elif num_new_images > 0:
|
425 |
-
image_tensor = our_chatbot.image_processor.preprocess(image_list, return_tensors="pt")["pixel_values"].half().to(our_chatbot.model.device)
|
426 |
-
|
427 |
|
428 |
image_token = DEFAULT_IMAGE_TOKEN * num_new_images + "\n"
|
429 |
|
@@ -659,7 +658,7 @@ with gr.Blocks(
|
|
659 |
[
|
660 |
{
|
661 |
"files": [
|
662 |
-
f"{cur_dir}/examples/realcase_video.
|
663 |
],
|
664 |
"text": "Please describe the video in detail.",
|
665 |
},
|
|
|
411 |
dst.write(src.read())
|
412 |
|
413 |
image_tensor = []
|
414 |
+
if is_video:
|
415 |
+
image_tensor = our_chatbot.image_processor.preprocess(image_list, return_tensors="pt")["pixel_values"].half().to(our_chatbot.model.device)
|
416 |
+
elif num_new_images > 0:
|
417 |
image_tensor = [
|
418 |
our_chatbot.image_processor.preprocess(f, return_tensors="pt")["pixel_values"][
|
419 |
0
|
|
|
423 |
for f in image_list
|
424 |
]
|
425 |
image_tensor = torch.stack(image_tensor)
|
|
|
|
|
|
|
426 |
|
427 |
image_token = DEFAULT_IMAGE_TOKEN * num_new_images + "\n"
|
428 |
|
|
|
658 |
[
|
659 |
{
|
660 |
"files": [
|
661 |
+
f"{cur_dir}/examples/realcase_video.jpg",
|
662 |
],
|
663 |
"text": "Please describe the video in detail.",
|
664 |
},
|