Skip to content

Commit 3e442ef

Browse files
authored
Revert "Update detect.py" (#2274)
* Revert "Update detect.py (#2174)" This reverts commit 0c0c1ed. * Update beta_snippets_test.py * Update beta_snippets.py * Update detect.py
1 parent 6a71c74 commit 3e442ef

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

vision/cloud-client/detect/beta_snippets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,9 @@ def async_batch_annotate_images_uri(input_image_uri, output_uri):
388388
localize_objects_uri(args.uri)
389389
elif 'handwritten-ocr-uri' in args.command:
390390
detect_handwritten_ocr_uri(args.uri)
391-
elif 'batch-annotate-files' in args.command:
391+
elif 'batch-annotate-files-uri' in args.command:
392392
detect_batch_annotate_files_uri(args.uri)
393-
elif 'batch-annotate-images' in args.command:
393+
elif 'batch-annotate-images-uri' in args.command:
394394
async_batch_annotate_images_uri(args.uri, args.output)
395395
else:
396396
if 'object-localization' in args.command:

vision/cloud-client/detect/beta_snippets_test.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,11 @@ def test_async_batch_annotate_images(capsys):
7979
gcs_uri = GCS_ROOT + 'landmark/eiffel_tower.jpg'
8080
beta_snippets.async_batch_annotate_images_uri(gcs_uri, GCS_DESTINATION_URI)
8181
out, _ = capsys.readouterr()
82-
assert 'language_code: "en"' in out
8382
assert 'description: "Tower"' in out
83+
84+
from google.cloud import storage
85+
storage_client = storage.Client()
86+
bucket = storage_client.get_bucket(BUCKET)
87+
if len(list(bucket.list_blobs(prefix=OUTPUT_PREFIX))) > 0:
88+
for blob in bucket.list_blobs(prefix=OUTPUT_PREFIX):
89+
blob.delete()

vision/cloud-client/detect/detect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ def async_detect_document(gcs_source_uri, gcs_destination_uri):
715715
# Process the first output file from GCS.
716716
# Since we specified batch_size=2, the first response contains
717717
# the first two pages of the input file.
718-
output = blob_list[1]
718+
output = blob_list[0]
719719

720720
json_string = output.download_as_string()
721721
response = json_format.Parse(

0 commit comments

Comments
 (0)