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

Revert "Update detect.py" #2274

Merged
merged 4 commits into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions vision/cloud-client/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 vision/cloud-client/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 vision/cloud-client/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