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

Move import inside region tags #2211

Merged
merged 2 commits into from
Jul 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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