Update app.py
Browse files
app.py
CHANGED
|
@@ -8,9 +8,8 @@ import json
|
|
| 8 |
import cv2
|
| 9 |
import numpy as np
|
| 10 |
from PIL import Image
|
| 11 |
-
|
| 12 |
-
from
|
| 13 |
-
from fl.engine.header import *
|
| 14 |
|
| 15 |
css = """
|
| 16 |
.example-image img{
|
|
@@ -100,7 +99,7 @@ def activate_fr_sdk():
|
|
| 100 |
if fr_key is None:
|
| 101 |
print_warning("Recognition online license key not found!")
|
| 102 |
else:
|
| 103 |
-
ret =
|
| 104 |
|
| 105 |
if ret == 0:
|
| 106 |
print_log("Successfully init FR SDK!")
|
|
@@ -117,7 +116,7 @@ def activate_fl_sdk():
|
|
| 117 |
if fl_key is None:
|
| 118 |
print_warning("Liveness Detection online license key not found!")
|
| 119 |
else:
|
| 120 |
-
ret =
|
| 121 |
|
| 122 |
if ret == 0:
|
| 123 |
print_log("Successfully init FL SDK!")
|
|
@@ -460,7 +459,7 @@ def compare_face(frame1, frame2):
|
|
| 460 |
image_mat1 = cv2.imdecode(np.frombuffer(image1.read(), np.uint8), cv2.IMREAD_COLOR)
|
| 461 |
image_mat2 = cv2.imdecode(np.frombuffer(image2.read(), np.uint8), cv2.IMREAD_COLOR)
|
| 462 |
start_time = time.time()
|
| 463 |
-
result, score, face_bboxes, face_features = compare_face(image_mat1, image_mat2, float(threshold))
|
| 464 |
end_time = time.time()
|
| 465 |
process_time = (end_time - start_time) * 1000
|
| 466 |
|
|
|
|
| 8 |
import cv2
|
| 9 |
import numpy as np
|
| 10 |
from PIL import Image
|
| 11 |
+
from fr.engine.header as fr_header
|
| 12 |
+
from fl.engine.header as fl_header
|
|
|
|
| 13 |
|
| 14 |
css = """
|
| 15 |
.example-image img{
|
|
|
|
| 99 |
if fr_key is None:
|
| 100 |
print_warning("Recognition online license key not found!")
|
| 101 |
else:
|
| 102 |
+
ret = fr_header.init_sdk(fr_dict_path.encode('utf-8'), fr_key.encode('utf-8'))
|
| 103 |
|
| 104 |
if ret == 0:
|
| 105 |
print_log("Successfully init FR SDK!")
|
|
|
|
| 116 |
if fl_key is None:
|
| 117 |
print_warning("Liveness Detection online license key not found!")
|
| 118 |
else:
|
| 119 |
+
ret = fl_header.init_sdk(fl_dict_path.encode('utf-8'), fl_key.encode('utf-8'))
|
| 120 |
|
| 121 |
if ret == 0:
|
| 122 |
print_log("Successfully init FL SDK!")
|
|
|
|
| 459 |
image_mat1 = cv2.imdecode(np.frombuffer(image1.read(), np.uint8), cv2.IMREAD_COLOR)
|
| 460 |
image_mat2 = cv2.imdecode(np.frombuffer(image2.read(), np.uint8), cv2.IMREAD_COLOR)
|
| 461 |
start_time = time.time()
|
| 462 |
+
result, score, face_bboxes, face_features = fr_header.compare_face(image_mat1, image_mat2, float(threshold))
|
| 463 |
end_time = time.time()
|
| 464 |
process_time = (end_time - start_time) * 1000
|
| 465 |
|