diff --git a/access_control_python/__pycache__/face_processing.cpython-311.pyc b/access_control_python/__pycache__/face_processing.cpython-311.pyc index 5d69bbe..c89a052 100644 Binary files a/access_control_python/__pycache__/face_processing.cpython-311.pyc and b/access_control_python/__pycache__/face_processing.cpython-311.pyc differ 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()