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 vision error when no results returned. #2750

Merged
merged 3 commits into from
Nov 17, 2016

Conversation

daspecster
Copy link
Contributor

Fixes #2749.

@daspecster daspecster added the api: vision Issues related to the Cloud Vision API. label Nov 17, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 17, 2016
@@ -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.

Copy link
Contributor

@dhermes dhermes left a 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.

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.

This comment was marked as spam.

@daspecster
Copy link
Contributor Author

@dhermes, I'll merge this and follow up with some test improvements.

@daspecster daspecster merged commit a10cf56 into googleapis:master Nov 17, 2016
@daspecster daspecster deleted the fix-vision-face-no-results branch November 17, 2016 21:34
richkadel pushed a commit to richkadel/google-cloud-python that referenced this pull request May 6, 2017
…-results

Fix vision error when no results returned.
parthea pushed a commit that referenced this pull request Oct 21, 2023
Fix vision error when no results returned.
parthea pushed a commit that referenced this pull request Oct 21, 2023
…#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vision Issues related to the Cloud Vision API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants