fix run class bug

This commit is contained in:
Siwat Sirichai 2023-09-25 01:47:30 +07:00
parent 3ee1e00519
commit 7285f9465b
3 changed files with 13 additions and 7 deletions

View file

@ -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