Skip to content

Commit

Permalink
also save video
Browse files Browse the repository at this point in the history
  • Loading branch information
yzld2002 committed Aug 28, 2024
1 parent 19d31c9 commit 2a2ef32
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions vision_agent/tools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,13 @@ def extract_frames(
video_file_path = video.download(output_path=temp_dir)

return extract_frames_from_video(video_file_path, fps)
elif str(video_uri).startswith(("http", "https")):
_, image_suffix = os.path.splitext(video_uri)
with tempfile.NamedTemporaryFile(delete=False, suffix=image_suffix) as tmp_file:
# Download the video and save it to the temporary file
with urllib.request.urlopen(str(video_uri)) as response:
tmp_file.write(response.read())
return extract_frames_from_video(tmp_file.name, fps)

return extract_frames_from_video(str(video_uri), fps)

Expand Down

0 comments on commit 2a2ef32

Please sign in to comment.