Source code for the following
The from aip import AipFace
"" your APPID AK SK" "" "
APP_ID='18814618'
API_KEY='A1bFwZeTGWRlg5MDk4ycu24q'
Vkorpae0lo1ttzpitx5njnexy7kcs SECRET_KEY='186'
Client=AipFace (APP_ID, API_KEY and SECRET_KEY)
"" "reading pictures "" "
Def get_file_content (filePath) :
With the open (filePath, 'rb') as fp:
Return fp. Read ()
Images=[
Get_file_content (" D://001 JPG "),
Get_file_content (" D://002 JPG "),
]
"" "call face than "" "
Client. The match (images);
"" "if there is an optional parameter "","
The options={}
Options (" ext_fields ")="qualities"
The options/" image_liveness "=", faceliveness "
The options (" types ")="7, 13"
"" "take parameters call face than "" "
Result=client. Match (images, options)
Print (result)
Error
The Object of type bytes is not a JSON serializable
CodePudding user response:
Images over there how to write
The import base64
Images=[
{' image ': STR (base64 b64encode (get_file_content (" D://001 JPG ")),' utf-8 '), 'image_type' : 'base64},
{' image ': STR (base64 b64encode (get_file_content (" D://002 JPG ")),' utf-8 '), 'image_type' : 'base64},
]
In addition, the following optional parameters that you go to, now preach parameter is put in the images