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

Vision: Add gRPC support for safe search. #2938

Merged

Conversation

daspecster
Copy link
Contributor

@daspecster daspecster commented Jan 17, 2017

Based from #2937

There's a few things I don't like about this that I'll comment on. I'm not sure how to solve them right now. Maybe you guys have some ideas?

@daspecster daspecster added the api: vision Issues related to the Cloud Vision API. label Jan 17, 2017
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 17, 2017
self.assertEqual(annotations.landmarks, [])
self.assertEqual(annotations.texts, [])
self.assertEqual(annotations.safe_searches, ())
self.assertEqual(annotations.properties, ())
self.assertEqual(len(annotations.safe_searches), 1)

This comment was marked as spam.

@daspecster daspecster changed the title Vision: Add GAPIC support for safe search. Vision: Add gRPC support for safe search. Jan 17, 2017
@daspecster daspecster force-pushed the vision-add-safe-search-from-pb branch 3 times, most recently from d337f84 to 259711d Compare January 23, 2017 17:49
@daspecster
Copy link
Contributor Author

@dhermes this should be ready to go. Let me know if you have any feedback.

"""
classifications = map(_get_pb_likelihood, [image.adult, image.spoof,
image.medical,
image.violence])

This comment was marked as spam.

self.assertIsInstance(annotations.safe_searches, SafeSearchAnnotation)
safe_search = annotations.safe_searches
unknown = Likelihood.UNKNOWN
self.assertEqual(safe_search.adult, unknown)

This comment was marked as spam.

@@ -0,0 +1,70 @@
# Copyright 2016 Google Inc.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.


def test_safe_search_annotation(self):
from google.cloud.vision.likelihood import Likelihood
from unit_tests._fixtures import SAFE_SEARCH_DETECTION_RESPONSE

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -224,8 +224,7 @@ categorize the entire contents of the image under four categories.
>>> client = vision.Client()
>>> with open('./image.jpg', 'rb') as image_file:
... image = client.image(content=image_file.read())
>>> safe_search_results = image.detect_safe_search()
>>> safe_search = safe_search_results[0]
>>> safe_search = image.detect_safe_search()

This comment was marked as spam.

This comment was marked as spam.

@@ -0,0 +1,70 @@
# Copyright 2016 Google Inc.

This comment was marked as spam.

@daspecster daspecster force-pushed the vision-add-safe-search-from-pb branch from 0aa5220 to 1086bc4 Compare January 23, 2017 19:08
@daspecster
Copy link
Contributor Author

daspecster commented Jan 23, 2017

Updated copyright for safe_search.py and squashed.

@daspecster daspecster merged commit 7d8860f into googleapis:master Jan 23, 2017
@daspecster daspecster deleted the vision-add-safe-search-from-pb branch January 23, 2017 19:28
@daspecster daspecster mentioned this pull request Jan 31, 2017
10 tasks
richkadel pushed a commit to richkadel/google-cloud-python that referenced this pull request May 6, 2017
…arch-from-pb

Vision: Add gRPC support for safe search.
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