Skip to content

Commit

Permalink
Adds updates for samples profiler ... vision [(#2439)](GoogleCloudPla…
Browse files Browse the repository at this point in the history
  • Loading branch information
gguuss authored and crwilcox committed Oct 7, 2019
1 parent af3aad9 commit eaf52b4
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 19 deletions.
4 changes: 2 additions & 2 deletions samples/snippets/crop_hints/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-vision==0.35.2
pillow==5.4.1
google-cloud-vision==0.39.0
pillow==6.1.0
2 changes: 1 addition & 1 deletion samples/snippets/detect/beta_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def async_batch_annotate_images_uri(input_image_uri, output_uri):
bucket_name = match.group(1)
prefix = match.group(2)

bucket = storage_client.get_bucket(bucket_name=bucket_name)
bucket = storage_client.get_bucket(bucket_name)

# Lists objects with the given prefix.
blob_list = list(bucket.list_blobs(prefix=prefix))
Expand Down
6 changes: 3 additions & 3 deletions samples/snippets/detect/detect_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,22 +265,22 @@ def test_detect_crop_hints(capsys):
'resources/wakeupcat.jpg')
detect.detect_crop_hints(file_name)
out, _ = capsys.readouterr()
assert 'bounds: (0,0)' in out
assert 'bounds: ' in out


def test_detect_crop_hints_uri(capsys):
file_name = 'gs://{}/vision/label/wakeupcat.jpg'.format(ASSET_BUCKET)
detect.detect_crop_hints_uri(file_name)
out, _ = capsys.readouterr()
assert 'bounds: (0,0)' in out
assert 'bounds: ' in out


def test_detect_crop_hints_http(capsys):
uri = 'https://storage-download.googleapis.com/{}' \
'/vision/label/wakeupcat.jpg'
detect.detect_crop_hints_uri(uri.format(ASSET_BUCKET))
out, _ = capsys.readouterr()
assert 'bounds: (0,0)' in out
assert 'bounds: ' in out


def test_async_detect_document(capsys):
Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/detect/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-vision==0.36.0
google-cloud-storage==1.13.2
google-cloud-vision==0.39.0
google-cloud-storage==1.19.1
2 changes: 1 addition & 1 deletion samples/snippets/document_text/doctext.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def render_doc_text(filein, fileout):
bounds = get_document_bounds(filein, FeatureType.WORD)
draw_boxes(image, bounds, 'yellow')

if fileout is not 0:
if fileout != 0:
image.save(fileout)
else:
image.show()
Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/document_text/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-vision==0.35.2
pillow==5.4.1
google-cloud-vision==0.39.0
pillow==6.1.0
3 changes: 2 additions & 1 deletion samples/snippets/face_detection/faces.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def detect_face(face_file, max_results=4):
content = face_file.read()
image = types.Image(content=content)

return client.face_detection(image=image, max_results=max_results).face_annotations
return client.face_detection(
image=image, max_results=max_results).face_annotations
# [END vision_face_detection_tutorial_send_request]


Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/face_detection/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-vision==0.35.2
Pillow==5.4.1
google-cloud-vision==0.39.0
Pillow==6.1.0
2 changes: 1 addition & 1 deletion samples/snippets/quickstart/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-vision==0.35.2
google-cloud-vision==0.39.0
2 changes: 1 addition & 1 deletion samples/snippets/web/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-vision==0.35.2
google-cloud-vision==0.39.0
8 changes: 5 additions & 3 deletions samples/snippets/web/web_detect_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,21 @@ def test_detect_file(capsys):
web_detect.report(web_detect.annotate(file_name))
out, _ = capsys.readouterr()
print(out)
assert 'description: palace of fine arts' in out.lower()
assert 'description' in out.lower()
assert 'palace' in out.lower()


def test_detect_web_gsuri(capsys):
file_name = ('gs://{}/vision/landmark/pofa.jpg'.format(
ASSET_BUCKET))
web_detect.report(web_detect.annotate(file_name))
out, _ = capsys.readouterr()
assert 'description: palace of fine arts' in out.lower()
assert 'description:' in out.lower()
assert 'palace' in out.lower()


def test_detect_web_http(capsys):
web_detect.report(web_detect.annotate(
'https://cloud.google.com/images/products/vision/extract-text.png'))
out, _ = capsys.readouterr()
assert 'https://cloud.google.com/vision' in out
assert 'web entities' in out.lower()

0 comments on commit eaf52b4

Please sign in to comment.