Skip to content

Conversation

davidcavazos
Copy link
Contributor

Adding code sample for vision to set a custom endpoint.

Python canonical: GoogleCloudPlatform/python-docs-samples#2569

@davidcavazos davidcavazos requested review from hongalex and tbpg December 3, 2019 20:23
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 3, 2019
GcsImageUri: "gs://cloud-samples-data/vision/text/screen.jpg",
},
}
texts, err := client.DetectTexts(ctx, image, nil, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the output of this change based on the endpoint? Is there a more direct way we can test the endpoint was actually set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the output changes, this is what they're doing in the canonical

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nnegrey do you know if there is a more direct way to test if the endpoint was actually used? Or is it completely transparent for users?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I know of for this API, you can pass an invalid endpoint and get an error. But no resource is created.

Natural Language for example has a different set of endpoints they support as documented here: https://cloud.google.com/natural-language/docs/locations

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we remove this portion of the test if it's not testing the sample? Or is it needed to make sure it still works after changing the endpoint?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly to just verify the endpoint works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tbpg how do you feel about this? Would you still want to change anything or should we go ahead and merge?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

Copy link
Contributor

@broady broady Dec 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the test, you could set the endpoint to a dummy gRPC server.

(But I think this is good enough.)

@davidcavazos davidcavazos force-pushed the vision_set_endpoint branch 4 times, most recently from 990bfc3 to 6723252 Compare December 4, 2019 19:26
@davidcavazos davidcavazos requested a review from tbpg December 10, 2019 19:49
@davidcavazos
Copy link
Contributor Author

@tbpg do you think this is ready?

@shuesc1
Copy link

shuesc1 commented Dec 17, 2019

Ping me when this is merged so I can add it to the docs. Thanks.

GcsImageUri: "gs://cloud-samples-data/vision/text/screen.jpg",
},
}
texts, err := client.DetectTexts(ctx, image, nil, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

@davidcavazos
Copy link
Contributor Author

@tbpg Can we merge this if you think it's ready? (I'm not authorized to merge)

@tbpg
Copy link
Contributor

tbpg commented Dec 23, 2019

Will wait for Kokoro then merge. Thanks!

@tbpg
Copy link
Contributor

tbpg commented Dec 23, 2019

Test failure is unrelated. Merging.

@tbpg tbpg merged commit b69d3ef into GoogleCloudPlatform:master Dec 23, 2019
@davidcavazos davidcavazos deleted the vision_set_endpoint branch December 24, 2019 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants