-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
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.
Some comments and questions, but this is definitely going in the right direction.
app/api/endpoints/image_queries.py
Outdated
@@ -43,19 +36,14 @@ async def post_image_query( | |||
) | |||
|
|||
if motion_detected or iq_response_is_improvable: |
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.
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 |
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.
Why remove this comment?
detector_id: str, | ||
wait: float = None, |
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.
Seems like we could still benefit from pydantic modeling here, right? Check that wait
is actually a float not a string.
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.