Skip to content

Commit

Permalink
Move import inside region tags (#2211)
Browse files Browse the repository at this point in the history
* Move import inside region tags

* Update detect.py
  • Loading branch information
nnegrey authored Jul 18, 2019
1 parent 3e442ef commit ee3c61f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion vision/cloud-client/detect/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
"""

import argparse
import io
import re


# [START vision_face_detection]
def detect_faces(path):
"""Detects faces in an image."""
from google.cloud import vision
import io
client = vision.ImageAnnotatorClient()

# [START vision_python_migration_face_detection]
Expand Down Expand Up @@ -107,6 +107,7 @@ def detect_faces_uri(uri):
def detect_labels(path):
"""Detects labels in the file."""
from google.cloud import vision
import io
client = vision.ImageAnnotatorClient()

# [START vision_python_migration_label_detection]
Expand Down Expand Up @@ -147,6 +148,7 @@ def detect_labels_uri(uri):
def detect_landmarks(path):
"""Detects landmarks in the file."""
from google.cloud import vision
import io
client = vision.ImageAnnotatorClient()

# [START vision_python_migration_landmark_detection]
Expand Down Expand Up @@ -191,6 +193,7 @@ def detect_landmarks_uri(uri):
def detect_logos(path):
"""Detects logos in the file."""
from google.cloud import vision
import io
client = vision.ImageAnnotatorClient()

# [START vision_python_migration_logo_detection]
Expand Down Expand Up @@ -231,6 +234,7 @@ def detect_logos_uri(uri):
def detect_safe_search(path):
"""Detects unsafe features in the file."""
from google.cloud import vision
import io
client = vision.ImageAnnotatorClient()

# [START vision_python_migration_safe_search_detection]
Expand Down Expand Up @@ -285,6 +289,7 @@ def detect_safe_search_uri(uri):
def detect_text(path):
"""Detects text in the file."""
from google.cloud import vision
import io
client = vision.ImageAnnotatorClient()

# [START vision_python_migration_text_detection]
Expand Down Expand Up @@ -335,6 +340,7 @@ def detect_text_uri(uri):
def detect_properties(path):
"""Detects image properties in the file."""
from google.cloud import vision
import io
client = vision.ImageAnnotatorClient()

# [START vision_python_migration_image_properties]
Expand Down Expand Up @@ -383,6 +389,7 @@ def detect_properties_uri(uri):
def detect_web(path):
"""Detects web annotations given an image."""
from google.cloud import vision
import io
client = vision.ImageAnnotatorClient()

# [START vision_python_migration_web_detection]
Expand Down Expand Up @@ -495,6 +502,7 @@ def web_entities_include_geo_results(path):
"""Detects web annotations given an image, using the geotag metadata
in the image to detect web entities."""
from google.cloud import vision
import io
client = vision.ImageAnnotatorClient()

with io.open(path, 'rb') as image_file:
Expand Down Expand Up @@ -543,6 +551,7 @@ def web_entities_include_geo_results_uri(uri):
def detect_crop_hints(path):
"""Detects crop hints in an image."""
from google.cloud import vision
import io
client = vision.ImageAnnotatorClient()

# [START vision_python_migration_crop_hints]
Expand Down Expand Up @@ -597,6 +606,7 @@ def detect_crop_hints_uri(uri):
def detect_document(path):
"""Detects document features in an image."""
from google.cloud import vision
import io
client = vision.ImageAnnotatorClient()

# [START vision_python_migration_document_text_detection]
Expand Down

0 comments on commit ee3c61f

Please sign in to comment.