diff --git a/vision/cloud-client/detect/beta_snippets.py b/vision/cloud-client/detect/beta_snippets.py index 5d792b9138bc..52dd00116c3a 100644 --- a/vision/cloud-client/detect/beta_snippets.py +++ b/vision/cloud-client/detect/beta_snippets.py @@ -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: diff --git a/vision/cloud-client/detect/beta_snippets_test.py b/vision/cloud-client/detect/beta_snippets_test.py index acbb5b7015e2..57f7c375ba74 100644 --- a/vision/cloud-client/detect/beta_snippets_test.py +++ b/vision/cloud-client/detect/beta_snippets_test.py @@ -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() diff --git a/vision/cloud-client/detect/detect.py b/vision/cloud-client/detect/detect.py index 616fdec3ee19..83974d15d209 100644 --- a/vision/cloud-client/detect/detect.py +++ b/vision/cloud-client/detect/detect.py @@ -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(