Unverified Commit 446ea332 authored by Li Bo's avatar Li Bo Committed by GitHub
Browse files

fix: creat new dict everytime for putting new frame (#1464)

parent 8f527e29
...@@ -217,17 +217,14 @@ def prepare_video_messages(video_path): ...@@ -217,17 +217,14 @@ def prepare_video_messages(video_path):
base64_frames.append(base64_str) base64_frames.append(base64_str)
messages = [{"role": "user", "content": []}] messages = [{"role": "user", "content": []}]
frame_format = {
"type": "image_url",
"image_url": {"url": "data:image/jpeg;base64,{}"},
"modalities": "video",
}
for base64_frame in base64_frames: for base64_frame in base64_frames:
frame_format["image_url"]["url"] = "data:image/jpeg;base64,{}".format( frame_format = {
base64_frame "type": "image_url",
) "image_url": {"url": f"data:image/jpeg;base64,{base64_frame}"},
messages[0]["content"].append(frame_format.copy()) "modalities": "video",
}
messages[0]["content"].append(frame_format)
prompt = {"type": "text", "text": "Please describe the video in detail."} prompt = {"type": "text", "text": "Please describe the video in detail."}
messages[0]["content"].append(prompt) messages[0]["content"].append(prompt)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment