-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 vision error when no results returned. #2750
Fix vision error when no results returned. #2750
Conversation
@@ -220,17 +220,18 @@ def _entity_from_response_type(feature_type, results): | |||
|
|||
detected_objects = [] | |||
feature_key = _REVERSE_TYPES[feature_type] | |||
annotations = results.get(feature_key, []) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
LGTM
@@ -116,6 +116,24 @@ def test_face_detection_from_content(self): | |||
image_request['image']['content']) | |||
self.assertEqual(5, image_request['features'][0]['maxResults']) | |||
|
|||
def test_face_detection_from_content_no_results(self): | |||
RETURNED = { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
faces = image.detect_faces(limit=5) | ||
self.assertEqual(faces, []) | ||
self.assertEqual(len(faces), 0) | ||
image_request = client._connection._requested[0]['data']['requests'][0] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@dhermes, I'll merge this and follow up with some test improvements. |
…-results Fix vision error when no results returned.
Fix vision error when no results returned.
…#2750)](GoogleCloudPlatform/python-docs-samples#2750) * automl: video beta - move beta samples out of branch and into master * lint * update error message on batch predict Co-authored-by: Leah E. Cole <6719667+leahecole@users.noreply.github.com>
Fixes #2749.