**请帮我一个简单的脚本,以python实现google vision API。
回溯(最近通话最近):文件 “ C:/Users/TAKWA/Desktop/vision/44.py”,第4行,在 vision_client = vision.Client()AttributeError:模块'google.cloud.vision'没有属性'Client'
import io
from google.cloud import vision
vision_client = vision.Client('my-key')
file_name = '1.jpg'
with io.open(file_name, 'rb') as image_file:
content = image_file.read()
image = vision_client.image(
content=content, )
labels = image.detect_labels()
for label in labels:
print(label.description)
答案 0 :(得分:2)
vision_client = vision.Client('my-key')
应该是
vision_client = vision.ImageAnnotatorClient()
https://cloud.google.com/vision/docs/libraries#using_the_client_library