Skip to content

Commit

Permalink
Revert "Update detect.py" [(#2274)](GoogleCloudPlatform/python-docs-s…
Browse files Browse the repository at this point in the history
…amples#2274)

* Revert "Update detect.py [(#2174)](GoogleCloudPlatform/python-docs-samples#2174)"

This reverts commit 6eaad9a.

* Update beta_snippets_test.py

* Update beta_snippets.py

* Update detect.py
  • Loading branch information
nnegrey committed Jul 18, 2019
1 parent 6eaad9a commit 60fe11c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions samples/snippets/detect/beta_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,9 @@ def async_batch_annotate_images_uri(input_image_uri, output_uri):
localize_objects_uri(args.uri)
elif 'handwritten-ocr-uri' in args.command:
detect_handwritten_ocr_uri(args.uri)
elif 'batch-annotate-files' in args.command:
elif 'batch-annotate-files-uri' in args.command:
detect_batch_annotate_files_uri(args.uri)
elif 'batch-annotate-images' in args.command:
elif 'batch-annotate-images-uri' in args.command:
async_batch_annotate_images_uri(args.uri, args.output)
else:
if 'object-localization' in args.command:
Expand Down
8 changes: 7 additions & 1 deletion samples/snippets/detect/beta_snippets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,11 @@ def test_async_batch_annotate_images(capsys):
gcs_uri = GCS_ROOT + 'landmark/eiffel_tower.jpg'
beta_snippets.async_batch_annotate_images_uri(gcs_uri, GCS_DESTINATION_URI)
out, _ = capsys.readouterr()
assert 'language_code: "en"' in out
assert 'description: "Tower"' in out

from google.cloud import storage
storage_client = storage.Client()
bucket = storage_client.get_bucket(BUCKET)
if len(list(bucket.list_blobs(prefix=OUTPUT_PREFIX))) > 0:
for blob in bucket.list_blobs(prefix=OUTPUT_PREFIX):
blob.delete()
2 changes: 1 addition & 1 deletion samples/snippets/detect/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ def async_detect_document(gcs_source_uri, gcs_destination_uri):
# Process the first output file from GCS.
# Since we specified batch_size=2, the first response contains
# the first two pages of the input file.
output = blob_list[1]
output = blob_list[0]

json_string = output.download_as_string()
response = json_format.Parse(
Expand Down

0 comments on commit 60fe11c

Please sign in to comment.