from aip import AipImageClassify

# 填写你的图像识别应用的App ID、API Key、Secret Key
APP_ID = ''
API_Key = ''
Secret_Key = ''
client = AipImageClassify(APP_ID, API_Key, Secret_Key)
# 读取图片数据
fileName = './image/animal01.jpg'
with open(fileName, 'rb') as fp:
    img = fp.read()
# 调用动物识别接口
result = client.animalDetect(img, {"top_num": 3})
# 格式化输出接口的返回值
result = result['result']
for item in result:
    print("动物：%s\t置信度：%s" % (item['name'], item['score']))
