Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
arithmetic1728 committed Sep 24, 2020
1 parent 7bee528 commit 44b7f2e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions samples/snippets/detect/detect.py
Expand Up @@ -805,6 +805,7 @@ def detect_document_uri(uri):
# [START vision_text_detection_pdf_gcs]
def async_detect_document(gcs_source_uri, gcs_destination_uri):
"""OCR with PDF/TIFF as source files on GCS"""
import json
import re
from google.cloud import vision
from google.cloud import storage
Expand Down Expand Up @@ -860,20 +861,18 @@ def async_detect_document(gcs_source_uri, gcs_destination_uri):
output = blob_list[0]

json_string = output.download_as_string()
print("====sijun detect.py: 863")
print(json_string)
response = vision.AnnotateFileResponse.from_json(json_string)
response = json.loads(json_string)

# The actual response for the first page of the input file.
first_page_response = response.responses[0]
annotation = first_page_response.full_text_annotation
first_page_response = response['responses'][0]
annotation = first_page_response['fullTextAnnotation']

# Here we print the full text from the first page.
# The response contains more information:
# annotation/pages/blocks/paragraphs/words/symbols
# including confidence scores and bounding boxes
print(u'Full text:\n{}'.format(
annotation.text))
print('Full text:\n')
print(annotation['text'])
# [END vision_text_detection_pdf_gcs]


Expand Down

0 comments on commit 44b7f2e

Please sign in to comment.