|
34 | 34 | """
|
35 | 35 |
|
36 | 36 | import argparse
|
37 |
| -import io |
38 | 37 | import re
|
39 | 38 |
|
40 | 39 |
|
41 | 40 | # [START vision_face_detection]
|
42 | 41 | def detect_faces(path):
|
43 | 42 | """Detects faces in an image."""
|
44 | 43 | from google.cloud import vision
|
| 44 | + import io |
45 | 45 | client = vision.ImageAnnotatorClient()
|
46 | 46 |
|
47 | 47 | # [START vision_python_migration_face_detection]
|
@@ -107,6 +107,7 @@ def detect_faces_uri(uri):
|
107 | 107 | def detect_labels(path):
|
108 | 108 | """Detects labels in the file."""
|
109 | 109 | from google.cloud import vision
|
| 110 | + import io |
110 | 111 | client = vision.ImageAnnotatorClient()
|
111 | 112 |
|
112 | 113 | # [START vision_python_migration_label_detection]
|
@@ -147,6 +148,7 @@ def detect_labels_uri(uri):
|
147 | 148 | def detect_landmarks(path):
|
148 | 149 | """Detects landmarks in the file."""
|
149 | 150 | from google.cloud import vision
|
| 151 | + import io |
150 | 152 | client = vision.ImageAnnotatorClient()
|
151 | 153 |
|
152 | 154 | # [START vision_python_migration_landmark_detection]
|
@@ -191,6 +193,7 @@ def detect_landmarks_uri(uri):
|
191 | 193 | def detect_logos(path):
|
192 | 194 | """Detects logos in the file."""
|
193 | 195 | from google.cloud import vision
|
| 196 | + import io |
194 | 197 | client = vision.ImageAnnotatorClient()
|
195 | 198 |
|
196 | 199 | # [START vision_python_migration_logo_detection]
|
@@ -231,6 +234,7 @@ def detect_logos_uri(uri):
|
231 | 234 | def detect_safe_search(path):
|
232 | 235 | """Detects unsafe features in the file."""
|
233 | 236 | from google.cloud import vision
|
| 237 | + import io |
234 | 238 | client = vision.ImageAnnotatorClient()
|
235 | 239 |
|
236 | 240 | # [START vision_python_migration_safe_search_detection]
|
@@ -285,6 +289,7 @@ def detect_safe_search_uri(uri):
|
285 | 289 | def detect_text(path):
|
286 | 290 | """Detects text in the file."""
|
287 | 291 | from google.cloud import vision
|
| 292 | + import io |
288 | 293 | client = vision.ImageAnnotatorClient()
|
289 | 294 |
|
290 | 295 | # [START vision_python_migration_text_detection]
|
@@ -335,6 +340,7 @@ def detect_text_uri(uri):
|
335 | 340 | def detect_properties(path):
|
336 | 341 | """Detects image properties in the file."""
|
337 | 342 | from google.cloud import vision
|
| 343 | + import io |
338 | 344 | client = vision.ImageAnnotatorClient()
|
339 | 345 |
|
340 | 346 | # [START vision_python_migration_image_properties]
|
@@ -383,6 +389,7 @@ def detect_properties_uri(uri):
|
383 | 389 | def detect_web(path):
|
384 | 390 | """Detects web annotations given an image."""
|
385 | 391 | from google.cloud import vision
|
| 392 | + import io |
386 | 393 | client = vision.ImageAnnotatorClient()
|
387 | 394 |
|
388 | 395 | # [START vision_python_migration_web_detection]
|
@@ -495,6 +502,7 @@ def web_entities_include_geo_results(path):
|
495 | 502 | """Detects web annotations given an image, using the geotag metadata
|
496 | 503 | in the image to detect web entities."""
|
497 | 504 | from google.cloud import vision
|
| 505 | + import io |
498 | 506 | client = vision.ImageAnnotatorClient()
|
499 | 507 |
|
500 | 508 | with io.open(path, 'rb') as image_file:
|
@@ -543,6 +551,7 @@ def web_entities_include_geo_results_uri(uri):
|
543 | 551 | def detect_crop_hints(path):
|
544 | 552 | """Detects crop hints in an image."""
|
545 | 553 | from google.cloud import vision
|
| 554 | + import io |
546 | 555 | client = vision.ImageAnnotatorClient()
|
547 | 556 |
|
548 | 557 | # [START vision_python_migration_crop_hints]
|
@@ -597,6 +606,7 @@ def detect_crop_hints_uri(uri):
|
597 | 606 | def detect_document(path):
|
598 | 607 | """Detects document features in an image."""
|
599 | 608 | from google.cloud import vision
|
| 609 | + import io |
600 | 610 | client = vision.ImageAnnotatorClient()
|
601 | 611 |
|
602 | 612 | # [START vision_python_migration_document_text_detection]
|
|
0 commit comments