Web detection: print annotations

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

Explore further

For detailed documentation that includes this code sample, see the following:

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.