From 3f3deb8a227401eafbb700d29e64ab60fdaced91 Mon Sep 17 00:00:00 2001 From: wuyiqunLu Date: Wed, 18 Sep 2024 12:22:48 +0800 Subject: [PATCH] clean up media download code --- vision_agent/agent/vision_agent.py | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/vision_agent/agent/vision_agent.py b/vision_agent/agent/vision_agent.py index 40195246..538e8c4e 100644 --- a/vision_agent/agent/vision_agent.py +++ b/vision_agent/agent/vision_agent.py @@ -223,25 +223,7 @@ def chat_with_code( for chat_i in int_chat: if "media" in chat_i: for media in chat_i["media"]: - if type(media) is str and media.startswith(("http", "https")): - # TODO: Ideally we should not call VA.tools here, we should come to revisit how to better support remote image later - file_path = str( - Path(self.local_artifacts_path).parent - / Path(media).name - ) - if file_path.lower().endswith( - ".mp4" - ) or file_path.lower().endswith(".mov"): - video_frames = extract_frames(media) - save_video( - [frame for frame, _ in video_frames], file_path - ) - else: - ndarray = load_image(media) - save_image(ndarray, file_path) - media = file_path - else: - media = cast(str, media) + media = cast(str, media) artifacts.artifacts[Path(media).name] = open(media, "rb").read() media_remote_path = (