Esempio n. 1
0
 def __init__(self,hass,face:dict,config:dict,users:dict,regex:dict):
     self.hass=hass
     self.face=aip.AipFace(str(face["appId"]),face["apiKey"],face["secretKey"])
     if self.face.getGroupUsers("werobot")["error_code"] != 0:
         raise AuthenticationError("人脸识别认证错误!")
     self.robot = werobot.WeRoBot()
     for k,v in config.items():
         self.robot.config[k]=v
     self.users=users
     self.regex=regex
     self.robot.config['HOST'] = '0.0.0.0'
     self.robot.add_handler(self.subscribe, "subscribe_event")
     self.robot.add_handler(self.recv,"text")
     self.robot.add_handler(self.recv, "voice")
     self.robot.add_handler(self.recv, "image")
Esempio n. 2
0
 def face(self, b64_img, face_field=appid.FIELD):
     self.faceAPI = aip.AipFace(self.__ID, self.__KEY, self.__SK)
     self.respond = self.faceAPI.detect(b64_img, self.imageType,
                                        self.options)
     return self.respond
Esempio n. 3
0
import aip

import cam

import FileDialog

client = aip.AipFace("Enter Your APP_ID", "Enter Your API_KEY",
                     "Enter Your SECRET_KEY")
cam.photo_capture("d:\\1.jpg", "q")
print(
    client.match(FileDialog.getOneFile(), FileDialog.getOneFile(),
                 options={})["score"])