signed

QiShunwang

“诚信为本、客户至上”

2020-12-28

2020/12/28 1:57:55   来源:

我用Python做了个百度ai识别动物,然后pycharm爆错,修改了多次没有解决,有没有大佬指点一下。--一个还没入门的萌新

from typing import List

from aip import AipImageClassify

APP_ID = '23400376'
API_KEY = 'B1HCn6FRminwoTPK4I0ilXvO'
SECRET_KEY = 'pXR92iGcAAdlSlBcF4UzF7GFx8e5Gb1g'

client = AipImageClassify(APP_ID, API_KEY, SECRET_KEY)
""" 读取图片 """
def get_file_content(filePath):
    with open(filePath, 'rb') as fp:
        return fp.read()

import os
path='./images'
image_list=os.listdir(path)
for i in image_list:
    """ 读取图片 """
    filename='./images/'+i
    """ 调用动物识别 """
    result=client.animalDetect(image_list(filename));
    print(filename,result)

在这里插入图片描述