Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -111,15 +111,22 @@ def check_liveness(frame):
|
|
| 111 |
if 'data' in json_result:
|
| 112 |
data = json_result['data']
|
| 113 |
print("the result data is is",data)
|
| 114 |
-
if data
|
| 115 |
-
liveness_result = f"""<div class="markdown-success-container"><p style="text-align: center; font-size: 20px; color: green;">Liveness Check:
|
| 116 |
-
json_output = {"Is Live": "
|
| 117 |
-
"document Type": data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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!"}]
|
| 125 |
else:
|
|
|
|
| 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: Live </p></div>"""
|
| 116 |
+
json_output = {"Is Live": "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 |
+
else:
|
| 123 |
+
liveness_result = f"""<div class="markdown-success-container"><p style="text-align: center; font-size: 20px; color: green;">Liveness Check: Fake</p></div>"""
|
| 124 |
+
json_output = {"Is Live": "Failed",
|
| 125 |
+
"document Type": data["DocumentType"],
|
| 126 |
# "Printed Cutout Check": "Failed" if printedCopy < printedCopyThreshold else "Success"
|
| 127 |
}
|
| 128 |
# Update json_result with the modified process_results
|
| 129 |
return [liveness_result, json_output]
|
|
|
|
| 130 |
liveness_result = f"""<div class="markdown-fail-container"><p style="text-align: center; font-size: 20px; color: red;">Liveness Check Failed</p></div>"""
|
| 131 |
return [liveness_result, {"status": "error", "result": "document not found!"}]
|
| 132 |
else:
|