Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -111,24 +111,14 @@ def check_liveness(frame):
|
|
111 |
if 'data' in json_result:
|
112 |
data = json_result['data']
|
113 |
print("the result data is is",data)
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
# Check for "Spoof" condition
|
124 |
-
if screenReply < screenReplayThreshold or portraitReplace < portraitReplaceThreshold or printedCopy < printedCopyThreshold:
|
125 |
-
liveness_result = f"""<div class="markdown-fail-container"><p style="text-align: center; font-size: 20px; color: red;">Liveness Check: SPOOF</p></div>"""
|
126 |
-
|
127 |
-
json_output = {"Screen Replay Check": "Failed" if screenReply < screenReplayThreshold else "Success",
|
128 |
-
"Portrait Replace Check": "Failed" if portraitReplace < portraitReplaceThreshold else "Success",
|
129 |
-
"Printed Cutout Check": "Failed" if printedCopy < printedCopyThreshold else "Success"}
|
130 |
-
# Update json_result with the modified process_results
|
131 |
-
return [liveness_result, json_output]
|
132 |
|
133 |
liveness_result = f"""<div class="markdown-fail-container"><p style="text-align: center; font-size: 20px; color: red;">Liveness Check Failed</p></div>"""
|
134 |
return [liveness_result, {"status": "error", "result": "document not found!"}]
|
|
|
111 |
if 'data' in json_result:
|
112 |
data = json_result['data']
|
113 |
print("the result data is is",data)
|
114 |
+
if data.IsLive :
|
115 |
+
liveness_result = f"""<div class="markdown-success-container"><p style="text-align: center; font-size: 20px; color: green;">Liveness Check: GENUINE</p></div>"""
|
116 |
+
json_output = {"Is Live": "Failed" if data.IsLive else "Success",
|
117 |
+
"document Type": data.DocumentType,
|
118 |
+
# "Printed Cutout Check": "Failed" if printedCopy < printedCopyThreshold else "Success"
|
119 |
+
}
|
120 |
+
# Update json_result with the modified process_results
|
121 |
+
return [liveness_result, json_output]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
liveness_result = f"""<div class="markdown-fail-container"><p style="text-align: center; font-size: 20px; color: red;">Liveness Check Failed</p></div>"""
|
124 |
return [liveness_result, {"status": "error", "result": "document not found!"}]
|