-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix product issues #257
Merged
Merged
Fix product issues #257
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7797433
strip installs from code
dillonalaird 25aa67c
make vision agent less verbose
dillonalaird 985fcbc
make artifact name more clear
dillonalaird 96ad669
don't load artifacts locally
dillonalaird 2499aea
added more error handling for saving files
dillonalaird 9ecf977
added prompt to keep code closer to user request
dillonalaird 85182e4
revert back to old prompt
dillonalaird f016436
revert back to old prompt
dillonalaird 5e33fcc
formatting fix
dillonalaird dbdb9b3
formatting fix
dillonalaird 71a7bd6
fix test case
dillonalaird 0a087ce
fix format issue
dillonalaird 9a1394e
merge overlay count into overlay bbox
dillonalaird File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,69 @@ | ||
# Generated by CodiumAI | ||
import os | ||
import tempfile | ||
from pathlib import Path | ||
|
||
import numpy as np | ||
|
||
from vision_agent.tools.tools import save_video | ||
from vision_agent.tools.tools import save_image, save_video | ||
|
||
|
||
class TestSaveVideo: | ||
def test_saves_frames_without_output_path(self): | ||
frames = [ | ||
np.random.randint(0, 256, (480, 640, 3), dtype=np.uint8) for _ in range(10) | ||
] | ||
output_path = save_video(frames) | ||
assert Path(output_path).exists() | ||
def test_saves_frames_without_output_path(): | ||
frames = [ | ||
np.random.randint(0, 256, (480, 640, 3), dtype=np.uint8) for _ in range(10) | ||
] | ||
output_path = save_video(frames) | ||
assert Path(output_path).exists() | ||
os.remove(output_path) | ||
|
||
|
||
def test_saves_frames_with_output_path(self, tmp_path): | ||
frames = [ | ||
np.random.randint(0, 256, (480, 640, 3), dtype=np.uint8) for _ in range(10) | ||
] | ||
video_output_path = str(tmp_path / "output.mp4") | ||
output_path = save_video(frames, video_output_path) | ||
def test_saves_frames_with_output_path(): | ||
frames = [ | ||
np.random.randint(0, 256, (480, 640, 3), dtype=np.uint8) for _ in range(10) | ||
] | ||
|
||
assert output_path == video_output_path | ||
with tempfile.TemporaryDirectory() as tmp_dir: | ||
video_output_path = Path(tmp_dir) / "output.mp4" | ||
output_path = save_video(frames, str(video_output_path)) | ||
|
||
assert output_path == str(video_output_path) | ||
assert Path(output_path).exists() | ||
|
||
|
||
def test_save_null_image(): | ||
image = None | ||
try: | ||
save_image(image, "tmp.jpg") | ||
except ValueError as e: | ||
assert str(e) == "The image is not a valid NumPy array with shape (H, W, C)" | ||
|
||
|
||
def test_save_empty_image(): | ||
image = np.zeros((0, 0, 3), dtype=np.uint8) | ||
try: | ||
save_image(image, "tmp.jpg") | ||
except ValueError as e: | ||
assert str(e) == "The image is not a valid NumPy array with shape (H, W, C)" | ||
|
||
|
||
def test_save_null_video(): | ||
frames = None | ||
try: | ||
save_video(frames, "tmp.mp4") | ||
except ValueError as e: | ||
assert str(e) == "Frames must be a list of NumPy arrays" | ||
|
||
|
||
def test_save_empty_list(): | ||
frames = [] | ||
try: | ||
save_video(frames, "tmp.mp4") | ||
except ValueError as e: | ||
assert str(e) == "Frames must be a list of NumPy arrays" | ||
|
||
|
||
def test_save_invalid_frame(): | ||
frames = [np.zeros((0, 0, 3), dtype=np.uint8)] | ||
try: | ||
save_video(frames, "tmp.mp4") | ||
except ValueError as e: | ||
assert str(e) == "A frame is not a valid NumPy array with shape (H, W, C)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if this is intended. but I'm not too familiar with the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was causing front end some issues. I did some local tests and I don't think removing it causes any issues