diff --git a/ruoyi-fastapi-backend/005测试compreface人脸识别服务.py b/ruoyi-fastapi-backend/005测试compreface人脸识别服务.py new file mode 100644 index 0000000..c266850 --- /dev/null +++ b/ruoyi-fastapi-backend/005测试compreface人脸识别服务.py @@ -0,0 +1,20 @@ +import requests + + + +def face_recognition_stream(image_path, url): + with open(image_path, 'rb') as f: + response = requests.post(url, data=f.read()) + return response.json() + +def face_recognition_file(image_path, url): + + files = {"file": ("test.jpg", open(image_path, "rb"), "image/jpeg")} + response = requests.post(url, files=files) + return response.json() + +if __name__ == '__main__': + image_path = './haotian.jpg' + url = 'http://10.0.0.202:9099/system/compreface/face_recognition' + # print(face_recognition_stream(image_path, url)) + print(face_recognition_file(image_path, url)) \ No newline at end of file diff --git a/ruoyi-fastapi-backend/server.py b/ruoyi-fastapi-backend/server.py index 3a712ed..01f672e 100644 --- a/ruoyi-fastapi-backend/server.py +++ b/ruoyi-fastapi-backend/server.py @@ -39,6 +39,7 @@ from module_admin.controller.identification_record_controller import identificat from module_admin.controller.door_controller import doorController from module_admin.controller.haikang_controller import haikang_controller from module_admin.controller.sys_alert_controller import sys_alertController +from module_admin.controller.compreface_controller import comprefaceController from sub_applications.handle import handle_sub_applications from utils.common_util import worship @@ -115,6 +116,7 @@ controller_list = [ {'router': doorController, 'tags': ['门禁设备管理']}, {'router': identification_statisticsController, 'tags': ['识别统计管理']}, {'router': haikang_controller, 'tags': ['海康']}, + {'router': comprefaceController, 'tags': ['人脸识别管理']}, # {'router': sys_alertController, 'tags': ['系统告警消息']} ]