Web detection: print annotations

Perform web detection on a file, URL, or Cloud Storage URI.

Documentation pages that include this code sample

To view the code sample used in context, see the following documentation:

Code sample

Python

Before trying this sample, follow the Python setup instructions in the Vision Quickstart Using Client Libraries. For more information, see the Vision Python API reference documentation.

if annotations.pages_with_matching_images:
    print('\n{} Pages with matching images retrieved'.format(
        len(annotations.pages_with_matching_images)))

    for page in annotations.pages_with_matching_images:
        print('Url   : {}'.format(page.url))

if annotations.full_matching_images:
    print('\n{} Full Matches found: '.format(
          len(annotations.full_matching_images)))

    for image in annotations.full_matching_images:
        print('Url  : {}'.format(image.url))

if annotations.partial_matching_images:
    print('\n{} Partial Matches found: '.format(
          len(annotations.partial_matching_images)))

    for image in annotations.partial_matching_images:
        print('Url  : {}'.format(image.url))

if annotations.web_entities:
    print('\n{} Web entities found: '.format(
          len(annotations.web_entities)))

    for entity in annotations.web_entities:
        print('Score      : {}'.format(entity.score))
        print('Description: {}'.format(entity.description))

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser