vision-agent 0.2.126__tar.gz → 0.2.127__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. {vision_agent-0.2.126 → vision_agent-0.2.127}/PKG-INFO +2 -1
  2. {vision_agent-0.2.126 → vision_agent-0.2.127}/pyproject.toml +2 -1
  3. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/tools/tools.py +3 -1
  4. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/utils/video.py +24 -5
  5. {vision_agent-0.2.126 → vision_agent-0.2.127}/LICENSE +0 -0
  6. {vision_agent-0.2.126 → vision_agent-0.2.127}/README.md +0 -0
  7. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/__init__.py +0 -0
  8. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/agent/__init__.py +0 -0
  9. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/agent/agent.py +0 -0
  10. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/agent/agent_utils.py +0 -0
  11. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/agent/vision_agent.py +0 -0
  12. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/agent/vision_agent_coder.py +0 -0
  13. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/agent/vision_agent_coder_prompts.py +0 -0
  14. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/agent/vision_agent_prompts.py +0 -0
  15. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/clients/__init__.py +0 -0
  16. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/clients/http.py +0 -0
  17. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/clients/landing_public_api.py +0 -0
  18. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/fonts/__init__.py +0 -0
  19. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/fonts/default_font_ch_en.ttf +0 -0
  20. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/lmm/__init__.py +0 -0
  21. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/lmm/lmm.py +0 -0
  22. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/lmm/types.py +0 -0
  23. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/tools/__init__.py +0 -0
  24. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/tools/meta_tools.py +0 -0
  25. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/tools/prompts.py +0 -0
  26. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/tools/tool_utils.py +0 -0
  27. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/tools/tools_types.py +0 -0
  28. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/utils/__init__.py +0 -0
  29. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/utils/exceptions.py +0 -0
  30. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/utils/execute.py +0 -0
  31. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/utils/image_utils.py +0 -0
  32. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/utils/sim.py +0 -0
  33. {vision_agent-0.2.126 → vision_agent-0.2.127}/vision_agent/utils/type_defs.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vision-agent
3
- Version: 0.2.126
3
+ Version: 0.2.127
4
4
  Summary: Toolset for Vision Agent
5
5
  Author: Landing AI
6
6
  Author-email: dev@landing.ai
@@ -10,6 +10,7 @@ Classifier: Programming Language :: Python :: 3.9
10
10
  Classifier: Programming Language :: Python :: 3.10
11
11
  Classifier: Programming Language :: Python :: 3.11
12
12
  Requires-Dist: anthropic (>=0.31.0,<0.32.0)
13
+ Requires-Dist: av (>=11.0.0,<12.0.0)
13
14
  Requires-Dist: e2b (>=0.17.2a50,<0.18.0)
14
15
  Requires-Dist: e2b-code-interpreter (==0.0.11a37)
15
16
  Requires-Dist: eva-decord (>=0.6.1,<0.7.0)
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "vision-agent"
7
- version = "0.2.126"
7
+ version = "0.2.127"
8
8
  description = "Toolset for Vision Agent"
9
9
  authors = ["Landing AI <dev@landing.ai>"]
10
10
  readme = "README.md"
@@ -42,6 +42,7 @@ pytube = "15.0.0"
42
42
  anthropic = "^0.31.0"
43
43
  pydantic = "2.7.4"
44
44
  eva-decord = "^0.6.1"
45
+ av = "^11.0.0"
45
46
 
46
47
  [tool.poetry.group.dev.dependencies]
47
48
  autoflake = "1.*"
@@ -1518,7 +1518,9 @@ def save_video(
1518
1518
  raise ValueError(f"fps must be greater than 0 got {fps}")
1519
1519
 
1520
1520
  if output_video_path is None:
1521
- output_video_path = tempfile.NamedTemporaryFile(delete=False).name
1521
+ output_video_path = tempfile.NamedTemporaryFile(
1522
+ delete=False, suffix=".mp4"
1523
+ ).name
1522
1524
 
1523
1525
  output_video_path = video_writer(frames, fps, output_video_path)
1524
1526
  _save_video_to_result(output_video_path)
@@ -5,6 +5,7 @@ from functools import lru_cache
5
5
  from typing import List, Optional, Tuple
6
6
 
7
7
  import cv2
8
+ import av # type: ignore
8
9
  import numpy as np
9
10
  from decord import VideoReader # type: ignore
10
11
 
@@ -43,18 +44,36 @@ def play_video(video_base64: str) -> None:
43
44
  cv2.destroyAllWindows()
44
45
 
45
46
 
47
+ def _resize_frame(frame: np.ndarray) -> np.ndarray:
48
+ height, width = frame.shape[:2]
49
+ new_width = width - (width % 2)
50
+ new_height = height - (height % 2)
51
+ return cv2.resize(frame, (new_width, new_height))
52
+
53
+
46
54
  def video_writer(
47
55
  frames: List[np.ndarray], fps: float = 1.0, filename: Optional[str] = None
48
56
  ) -> str:
49
57
  if filename is None:
50
58
  filename = tempfile.NamedTemporaryFile(delete=False, suffix=".mp4").name
51
-
52
- fourcc = cv2.VideoWriter_fourcc(*"mp4v") # type: ignore
59
+ container = av.open(filename, mode="w")
60
+ stream = container.add_stream("h264", rate=fps)
53
61
  height, width = frames[0].shape[:2]
54
- writer = cv2.VideoWriter(filename, fourcc, fps, (width, height))
62
+ stream.height = height - (height % 2)
63
+ stream.width = width - (width % 2)
64
+ stream.pix_fmt = "yuv420p"
55
65
  for frame in frames:
56
- writer.write(cv2.cvtColor(frame, cv2.COLOR_RGB2BGR))
57
- writer.release()
66
+ # Remove the alpha channel (convert RGBA to RGB)
67
+ frame_rgb = frame[:, :, :3]
68
+ # Resize the frame to make dimensions divisible by 2
69
+ frame_rgb = _resize_frame(frame_rgb)
70
+ av_frame = av.VideoFrame.from_ndarray(frame_rgb, format="rgb24")
71
+ for packet in stream.encode(av_frame):
72
+ container.mux(packet)
73
+
74
+ for packet in stream.encode():
75
+ container.mux(packet)
76
+ container.close()
58
77
  return filename
59
78
 
60
79
 
File without changes
File without changes