Skip to content

Commit 7a21560

Browse files
chore: clean up Vision quickstart (GoogleCloudPlatform#10405)
* chore: clean up Vision quickstart * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * per reviewer * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * per reviewer * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 3b42343 commit 7a21560

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

vision/snippets/quickstart/quickstart.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
# limitations under the License.
1616

1717
# [START vision_quickstart]
18-
import os
1918

2019
# Imports the Google Cloud client library
2120
# [START vision_python_migration_import]
@@ -32,14 +31,11 @@ def run_quickstart() -> vision.EntityAnnotation:
3231
client = vision.ImageAnnotatorClient()
3332
# [END vision_python_migration_client]
3433

35-
# The name of the image file to annotate
36-
file_name = os.path.abspath("resources/wakeupcat.jpg")
34+
# The URI of the image file to annotate
35+
file_uri = "gs://cloud-samples-data/vision/label/wakeupcat.jpg"
3736

38-
# Loads the image into memory
39-
with open(file_name, "rb") as image_file:
40-
content = image_file.read()
41-
42-
image = vision.Image(content=content)
37+
image = vision.Image()
38+
image.source.image_uri = file_uri
4339

4440
# Performs label detection on the image file
4541
response = client.label_detection(image=image)
@@ -52,7 +48,4 @@ def run_quickstart() -> vision.EntityAnnotation:
5248
return labels
5349

5450

55-
if __name__ == "__main__":
56-
run_quickstart()
57-
5851
# [END vision_quickstart]

0 commit comments

Comments
 (0)