使用CloudSight API进行图像识别的Python脚本

# -*- coding: utf-8 -*-
# @Time    : 2018/03/20 17:02
# @Author  : cxa
# @File    : sss.py
# @Software: PyCharm
import cloudsight
auth = cloudsight.SimpleAuth('apikey')
api = cloudsight.API(auth)
with open('1.png', 'rb') as f:
    response = api.image_request(f, '1.png', {
        'image_request[locale]': 'en-US',
    })
status = api.image_response(response['token'])
print(status)
if status['status'] != cloudsight.STATUS_NOT_COMPLETED:
    # Done!
    pass
status = api.wait(response['token'], timeout=30)

  

原文地址:https://www.cnblogs.com/c-x-a/p/8610071.html