from aip.base import base64
from aip import AipFace
""" 你的 APPID AK SK """
APP_ID = 'XXX'
API_KEY = 'CSGLYgVhSXXXXXM2tESa'
SECRET_KEY = 'G6bYXXXiIiOb5ZCOasUSAACR'
client = AipFace(APP_ID, API_KEY, SECRET_KEY)
#百度人脸对比(222203解析失败处理,需str(img,'utf-8'))
result = client.match([
{
'image': str(base64.b64encode(open('C:/Envs/FaceTest/1.jpg', 'rb').read()),'utf-8'),
'image_type': 'BASE64',
'face_type':'LIVE',
},
{
'image': str(base64.b64encode(open('C:/Envs/FaceTest/3.png', 'rb').read()),'utf-8'),
'image_type':'BASE64',
'face_type':'LIVE',
}
])
print(result)