diff --git a/samples/snippets/detect/beta_snippets.py b/samples/snippets/detect/beta_snippets.py index 5d792b91..52dd0011 100644 --- a/samples/snippets/detect/beta_snippets.py +++ b/samples/snippets/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/samples/snippets/detect/beta_snippets_test.py b/samples/snippets/detect/beta_snippets_test.py index acbb5b70..57f7c375 100644 --- a/samples/snippets/detect/beta_snippets_test.py +++ b/samples/snippets/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/samples/snippets/detect/detect.py b/samples/snippets/detect/detect.py index 616fdec3..83974d15 100644 --- a/samples/snippets/detect/detect.py +++ b/samples/snippets/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(