Skip to content
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 post_image_query Endpoint #11

Merged
merged 7 commits into from
Jul 21, 2023
Merged

Conversation

blaise-muhirwa
Copy link
Contributor

This PR allows us to pass raw bytes to the post_image_query endpoint. Previously, we were encoding bytes into a base64 string and using the Pydantic validator decorator to get bytes from the encoded string. That was problematic because the SDK just works with bytes and we want to have the exact same interface on the edge.

Copy link
Member

@robotrapta robotrapta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments and questions, but this is definitely going in the right direction.

@@ -43,19 +36,14 @@ async def post_image_query(
)

if motion_detected or iq_response_is_improvable:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember the iq_response_is_improvable logic. The name is confusing, and I don't think the logic is correct. We shouldn't make motion-detection decisions based on the confidence of the server response.

@@ -43,19 +36,14 @@ async def post_image_query(
)

if motion_detected or iq_response_is_improvable:
image_query = gl.submit_image_query(detector=detector_id, image=image, wait=wait_time)

# Store the cloud's response so that if the next image has no motion, we will return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this comment?

Comment on lines +20 to +21
detector_id: str,
wait: float = None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we could still benefit from pydantic modeling here, right? Check that wait is actually a float not a string.

@blaise-muhirwa blaise-muhirwa merged commit 7ba12ec into main Jul 21, 2023
@blaise-muhirwa blaise-muhirwa deleted the fix_submit_iq_endpoint branch July 21, 2023 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants