fix: creat new dict everytime for putting new frame (#1464)
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user