最后编辑于2022-03
{u'log_id': 1520120155451L, u'timestamp': 1529996449, u'cached': 0, u'result': None, u'error_code': 222001, u'error_msg': u'param[image] is null'}
提示上面的错误,如何修改?(python2.7)
代码如下
# -*- coding: UTF-8 -*-
from aip import AipFace
# 定义常量
APP_ID = '9851066'
API_KEY = 'LUGBatgyRGoerR9FZbV4SQYk'
SECRET_KEY = 'fB2MNz1c2UHLTximFlC4laXPg7CVfyjV'
# 初始化AipFace对象
aipFace = AipFace(APP_ID, API_KEY, SECRET_KEY)
# 读取图片
filePath = "1.jpg"
def get_file_content(filePath):
with open(filePath, 'rb') as fp:
return fp.read()
# 定义参数变量
options = {
'max_face_num': 1,
'face_fields': "age,beauty,expression,faceshape",
}
# 调用人脸属性检测接口
result = aipFace.detect(get_file_content(filePath),options)
print(result)
print(type(result))
收藏
点赞
0
个赞
请登录后评论
TOP
切换版块
醍醐灌顶,非常感谢
sdk更新成最新的
可以参考 http://ai.baidu.com/forum/topic/show/864836