edreesi commited on
Commit
e1f071d
·
verified ·
1 Parent(s): 2c3dcf5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -18
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
- process_results = json_result.get("result")
116
- status = process_results.get("status")
117
- if status == "Ok":
118
- screenReply = process_results.get("screenReply")
119
- portraitReplace = process_results.get("portraitReplace")
120
- printedCopy = process_results.get("printedCopy")
121
- liveness_result = f"""<div class="markdown-success-container"><p style="text-align: center; font-size: 20px; color: green;">Liveness Check: GENUINE</p></div>"""
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!"}]