From 7285f9465bf20504e1e9349d776c86cd44d4fca3 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Mon, 25 Sep 2023 01:47:30 +0700 Subject: [PATCH] fix run class bug --- .../face_processing.cpython-311.pyc | Bin 1752 -> 1960 bytes access_control_python/face_processing.py | 14 +++++++++++--- access_control_python_server/app.py | 6 ++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/access_control_python/__pycache__/face_processing.cpython-311.pyc b/access_control_python/__pycache__/face_processing.cpython-311.pyc index 5d69bbe72c47acd6b9a52a113f0e4da945996493..c89a0525f4a47fbb6d29b48a672820ed255e3d22 100644 GIT binary patch delta 606 zcmcb?yMmu@IWI340}wPd38V_KOytWnl*}k8DX`MlH?%a;Gc>c%Gte_KwzM)eFfd4F z1gV4q79h?Mlp+pp@2nw>eCm&#u z!gR2uNsh z772scvLHfavIeW7ZZXI}1sEuj2J&w4W~QX(m1L$>#-}AFrxqy!#Uy~ZcsbDHW|KFv zI@hysb|^P`wRkmnkrE7t_(hyl7!Ij0IcYF!a@}IhE6pvayv3AP0PzsmFJK>l9Srs< zD9~@Qrsd=(mVn){lHoH@M4AEY&|e%jx%nxjIjMF<>OfIY1Q!=fPGYlg_`t@%r`f>u dfsLDy{{sV@km6zFU!nSe0Z8E_iqwF{0081EiuC{h delta 382 zcmZ3%e}k8AIWI340}xcz38c0%PvpxK6wN3pDX`Ml&&f|t%*n_vE}7UP&8RVP#sA4G z88s$9WHe@6Ia!qHGnXt-7f5Sy^JG~zv&kOJcH(!r_cCgT36$34ED`}yMe>u+vnm=DNdwu%AaMm4 zD3Ss4Zt-TOq~?`mrd7tLB_^j9DFMYm+KStO)>r0X*jywBl+@(9#hO=|TTpq6DX*Z2 z8z@r53nBzS1P6!!`Jf2om0PT7Ir)htU~^Y8fOUiI{l#IEo1apelWJF_4phbn#Kn1& j4cIO09`LF(aD8CoVC4V604GF%tQD$A0thKM3v4(5HRfHx diff --git a/access_control_python/face_processing.py b/access_control_python/face_processing.py index df66e5a..59640d1 100644 --- a/access_control_python/face_processing.py +++ b/access_control_python/face_processing.py @@ -4,7 +4,8 @@ import base64 import requests import json -api_server = "http://localhost:5000" +#api_server = "http://localhost:5000" +api_server = "http://192.168.0.239:5000" #api_server = "https://racist.siwatsystem.com" def analyze_face(img): @@ -14,7 +15,10 @@ def analyze_face(img): data = {"image":b64_img.decode("utf-8")} req = requests.post(endpoint,json=data) res = res.content.decode("utf-8") - res = json.loads(res) + try: + res = json.loads(res) + except: + pass return res def identify_face(img, target_condidence: float): @@ -24,5 +28,9 @@ def identify_face(img, target_condidence: float): data = {"image":b64_img.decode("utf-8"),"target_confidence": target_condidence} req = requests.post(endpoint,json=data) res = req.content.decode("utf-8") - res = json.loads(res) + print(res) + try: + res = json.loads(res) + except: + pass return res \ No newline at end of file diff --git a/access_control_python_server/app.py b/access_control_python_server/app.py index 31718ac..179f524 100644 --- a/access_control_python_server/app.py +++ b/access_control_python_server/app.py @@ -20,6 +20,8 @@ def init_face() -> None: face_image = face.load_image_file(file.path) face_encodings.append(face.face_encodings(face_image)[0]) +init_face() + @app.route('/') def home() -> str: return '

Ching Chong Bing Bong Ding Dong!!

' @@ -59,8 +61,4 @@ def identify_face() -> str: if __name__ == '__main__': - init_face() - print(face_names) - print(face_encodings) - app.run()