Skip to content

Commit

Permalink
Vision - remove unused region tags (#1620)
Browse files Browse the repository at this point in the history
  • Loading branch information
alixhami authored Aug 10, 2018
1 parent 5ae5675 commit 635150e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 0 additions & 2 deletions vision/api/label/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def main(photo_file):
service = googleapiclient.discovery.build('vision', 'v1')
# [END authenticate]

# [START construct_request]
with open(photo_file, 'rb') as image:
image_content = base64.b64encode(image.read())
service_request = service.images().annotate(body={
Expand All @@ -55,7 +54,6 @@ def main(photo_file):
}]
}]
})
# [END construct_request]
# [START parse_response]
response = service_request.execute()
label = response['responses'][0]['labelAnnotations'][0]['description']
Expand Down
4 changes: 2 additions & 2 deletions vision/cloud-client/detect/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def detect_web_uri(uri):
# [START vision_web_entities_include_geo_results]
def web_entities_include_geo_results(path):
"""Detects web annotations given an image, using the geotag metadata
in the iamge to detect web entities."""
in the image to detect web entities."""
client = vision.ImageAnnotatorClient()

with io.open(path, 'rb') as image_file:
Expand All @@ -503,7 +503,7 @@ def web_entities_include_geo_results(path):
# [START vision_web_entities_include_geo_results_uri]
def web_entities_include_geo_results_uri(uri):
"""Detects web annotations given an image in the file located in
Google Cloud Storage., using the geotag metadata in the iamge to
Google Cloud Storage., using the geotag metadata in the image to
detect web entities."""
client = vision.ImageAnnotatorClient()

Expand Down
4 changes: 0 additions & 4 deletions vision/cloud-client/document_text/doctext.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class FeatureType(Enum):

def draw_boxes(image, bounds, color):
"""Draw a border around the image using the hints in the vector list."""
# [START draw_blocks]
draw = ImageDraw.Draw(image)

for bound in bounds:
Expand All @@ -51,7 +50,6 @@ def draw_boxes(image, bounds, color):
bound.vertices[2].x, bound.vertices[2].y,
bound.vertices[3].x, bound.vertices[3].y], None, color)
return image
# [END draw_blocks]


def get_document_bounds(image_file, feature):
Expand Down Expand Up @@ -96,7 +94,6 @@ def get_document_bounds(image_file, feature):


def render_doc_text(filein, fileout):
# [START render_doc_text]
image = Image.open(filein)
bounds = get_document_bounds(filein, FeatureType.PAGE)
draw_boxes(image, bounds, 'blue')
Expand All @@ -109,7 +106,6 @@ def render_doc_text(filein, fileout):
image.save(fileout)
else:
image.show()
# [END render_doc_text]


if __name__ == '__main__':
Expand Down

0 comments on commit 635150e

Please sign in to comment.