From cb2986ca91efb5092755f063d33dab1b695216ef Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 26 Jan 2022 17:03:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=85=A7=E7=89=87bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/hrm/services.py | 4 ++-- hb_server/apps/hrm/views.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hb_server/apps/hrm/services.py b/hb_server/apps/hrm/services.py index 7f7334b..1a793b1 100644 --- a/hb_server/apps/hrm/services.py +++ b/hb_server/apps/hrm/services.py @@ -40,9 +40,9 @@ class HRMService: return user, '' return None, '识别失败' - def get_facedata_from_img(cls, img_rpath): + def get_facedata_from_img(cls, img_path): try: - photo_path = settings.BASE_DIR + img_rpath + photo_path = settings.BASE_DIR + img_path picture_of_me = face_recognition.load_image_file(photo_path) my_face_encoding = face_recognition.face_encodings(picture_of_me)[0] face_data_list = my_face_encoding.tolist() diff --git a/hb_server/apps/hrm/views.py b/hb_server/apps/hrm/views.py index 8755b18..89dfa66 100644 --- a/hb_server/apps/hrm/views.py +++ b/hb_server/apps/hrm/views.py @@ -42,7 +42,7 @@ class EmployeeViewSet(CreateUpdateModelAMixin, OptimizationMixin, UpdateModelMix serializer.is_valid(raise_exception=True) photo = data.get('photo', None) if instance.photo != photo: - f_l = HRMService.get_facedata_from_img(photo) + f_l = HRMService.get_facedata_from_img(img_path=photo) if f_l: serializer.save(update_by=request.user, face_data = f_l) # 更新人脸缓存