From 28266be8a52098bd5d9664bdc6e581e9baa180b1 Mon Sep 17 00:00:00 2001 From: haotian <2421912570@qq.com> Date: Tue, 23 Sep 2025 10:13:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0compreface=E4=BA=BA=E8=84=B8?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../005测试compreface人脸识别服务.py | 20 +++++++++++++++++++ ruoyi-fastapi-backend/server.py | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 ruoyi-fastapi-backend/005测试compreface人脸识别服务.py 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': ['系统告警消息']} ]