0

私はPythonでいくつかのスクリプトをいじっていて、これらの画像が結果を返すかどうかを調べようとしています. ただし、python を実行しても何も出力されません。エラーは発生しませんが、理解できないようです。

import io
import os

# Imports the Google Cloud client library
from google.cloud import vision
from google.cloud.vision import types

def run(annotations):
# Instantiates a client
    client = vision.ImageAnnotatorClient()

# The name of the image file to annotate
    file_name = os.path.join(
        os.path.dirname(__file__),
        'static/123456.jpg')

# Loads the image into memory
    with io.open(file_name, 'rb') as image_file:
        content = image_file.read()

        image = types.Image(content=content)

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


    matching = annotations.pages_with_matching_images


        print matching

私はこれらの例に基づいて作業しています

https://cloud.google.com/vision/docs/quickstart-client-libraries#client-libraries-install-python

https://cloud.google.com/vision/docs/internet-detection

4

1 に答える 1