Pavanupadhyay27 commited on
Commit
7c11686
·
1 Parent(s): 787a29c

Make mock mode similarity and liveness scores dynamic for realistic demo visuals

Browse files
backend/app/api/v1/kiosk.py CHANGED
@@ -201,7 +201,8 @@ def scan_face(
201
 
202
  if face_engine.mock_mode:
203
  # Override match similarity in mock mode to allow functional kiosk scans during demos
204
- similarity = 0.85
 
205
 
206
  if similarity < face_threshold:
207
  # Low confidence match -> Unknown
 
201
 
202
  if face_engine.mock_mode:
203
  # Override match similarity in mock mode to allow functional kiosk scans during demos
204
+ import random
205
+ similarity = random.uniform(0.81, 0.94)
206
 
207
  if similarity < face_threshold:
208
  # Low confidence match -> Unknown
backend/app/services/face_engine.py CHANGED
@@ -385,7 +385,9 @@ class FaceEngine:
385
  # Default mock liveness: Check if the photo is in color and average variance is high
386
  # We return True for mock testing, with high liveness score (0.95)
387
  # If the image filename/source contains "spoof" we return False
388
- return 0.92, True
 
 
389
 
390
  try:
391
  x1, y1, x2, y2 = bbox
 
385
  # Default mock liveness: Check if the photo is in color and average variance is high
386
  # We return True for mock testing, with high liveness score (0.95)
387
  # If the image filename/source contains "spoof" we return False
388
+ import random
389
+ score = random.uniform(0.91, 0.98)
390
+ return score, True
391
 
392
  try:
393
  x1, y1, x2, y2 = bbox