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

Initial Vision usage docs for discussion #1809

Closed
wants to merge 2 commits into from

Conversation

daspecster
Copy link
Contributor

@daspecster daspecster commented May 18, 2016

Here is a rough outline of the Vision usage RST.

Originally mentioned here.

The usage here essentially implies direct conversion of the responses to objects.
I think we have room here to add helper methods which could add value.

Let's discuss!

@daspecster daspecster added do not merge Indicates a pull request not ready for merge, due to either quality or timing. api: vision Issues related to the Cloud Vision API. labels May 18, 2016
@daspecster daspecster added this to the Vision Alpha milestone May 18, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 18, 2016

.. doctest::

>>> images = (('./image.jpg', [vision.FeatureTypes.LABEL_DETECTION,

This comment was marked as spam.

@theacodes
Copy link
Contributor

/cc @jerjou

>>> annotated_images = []
>>> for image, feature_types in images:
... annotated_images.append(
... vision_client.annotate(

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.

This comment was marked as spam.

This comment was marked as spam.

@jgeewax
Copy link
Contributor

jgeewax commented May 18, 2016

Can you take a look at our Vision docs for Ruby that do things slightly differently? https://quartzmo.github.io/gcloud-ruby/#/docs/master/gcloud/vision

@daspecster
Copy link
Contributor Author

@jgeewax I like their examples!

Are you saying to look at their docs as an example for the usage layout or for how their API is defined...or both I suppose?

I can condense this down a bit. I wanted to layout the cases here so we could discuss the API surface.

@quartzmo
Copy link
Member

@jgeewax @daspecster I'm working on updating our Vision docs demo with googleapis/google-cloud-ruby#696 and another pending PR, just FYI.

@daspecster
Copy link
Contributor Author

One thing that I'm not sure about in gcloud-ruby is that the way they do the multiple images example. I think it actually would cost more since there would be multiple API requests?

However I guess since the charging is based on the feature types that in their example it wouldn't make any difference?

analyses = vision.annotate do |annotate|
   annotate.annotate face_image, faces: 10, labels: 10
   annotate.annotate landmark_image, landmarks: 10
   annotate.annotate text_image, text: true
end

In that case I guess the only part in question is request overhead. I think the batching discussion will get there though.

@quartzmo
Copy link
Member

We have changed our API to accept booleans as well as max results, so when updated, most examples will use this new syntax:

annotation = vision.annotate image, faces: true, labels: true

@daspecster
Copy link
Contributor Author

@quartzmo, I like changing the max_results to true, since with some feature types rarely if ever would more than one result be returned.

I could take that out here and just make the default max_results=1 and then not that in the docs but leave it out of most of the examples.

@quartzmo
Copy link
Member

@daspecster The batch example you mention above results in a single API request. Nothing happens until the block execution completes.

@daspecster
Copy link
Contributor Author

@quartzmo, I see now. Thanks!

@quartzmo
Copy link
Member

@daspecster We released our Vision support today in case you want to try it.

@daspecster
Copy link
Contributor Author

@quartzmo thanks! I'll give it a go this weekend.

@tseaver tseaver mentioned this pull request May 23, 2016
6 tasks

- In addition to any authentication configuration, you should also set the
:envvar:`GCLOUD_PROJECT` environment variable for the project you'd like
to interact with. If you are Google App Engine or Google Compute Engine

This comment was marked as spam.

@dhermes
Copy link
Contributor

dhermes commented May 23, 2016

General comment: Though there is only one method provided by the backend API, we can and should have many methods in our API, matching the concepts at the level you provide in each docs subsection.

@daspecster
Copy link
Contributor Author

@dhermes @tseaver, the doc was updated with convenience methods like detect_labels() etc.
Not sure why it days they were added 9 days ago though? I pushed it on one of those github outage days.

If you guys want to take a look at it again and let me know what you think that would be awesome!

@daspecster
Copy link
Contributor Author

@dhermes @tseaver, just wanted to try and keep this alive. Let me know if you have any comments! If not then I'll start working on implementing this Thursday(June 2nd).

Thanks!

@tseaver
Copy link
Contributor

tseaver commented May 31, 2016

LGTM to go forward with the surface as described.

@daspecster
Copy link
Contributor Author

daspecster commented May 31, 2016

Closing since we shouldn't have a usage doc with no surface methods available yet.

Reopen if we want to chat more about any of this!

@daspecster daspecster closed this May 31, 2016
@daspecster
Copy link
Contributor Author

/cc @jgeewax

@daspecster daspecster deleted the vision-usage branch January 24, 2017 15:17
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. do not merge Indicates a pull request not ready for merge, due to either quality or timing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants