feat: implement FastAPI endpoints for face registration, attendance marking with liveness detection and lighting analysis, and face detection.
Browse files- app/api/endpoints.py +2 -2
app/api/endpoints.py
CHANGED
|
@@ -84,7 +84,7 @@ async def log_spoof_attempt(student_id: str, img: np.ndarray, score: float, ligh
|
|
| 84 |
"lighting_quality": lighting_data.get("lighting_quality") if lighting_data else "UNKNOWN",
|
| 85 |
"brightness": lighting_data.get("brightness") if lighting_data else 0
|
| 86 |
}
|
| 87 |
-
requests.post
|
| 88 |
except Exception as e:
|
| 89 |
logger.error(f"Failed to log spoof attempt: {e}")
|
| 90 |
|
|
@@ -130,7 +130,7 @@ async def mark_attendance(
|
|
| 130 |
|
| 131 |
if not liveness_passed:
|
| 132 |
# LOG SPOOF ATTEMPT with lighting data
|
| 133 |
-
await
|
| 134 |
|
| 135 |
return AttendanceResponse(
|
| 136 |
studentId=None,
|
|
|
|
| 84 |
"lighting_quality": lighting_data.get("lighting_quality") if lighting_data else "UNKNOWN",
|
| 85 |
"brightness": lighting_data.get("brightness") if lighting_data else 0
|
| 86 |
}
|
| 87 |
+
await run_in_threadpool(requests.post, f"{settings.CORE_SERVER_URL}/api/v1/audit/spoof-attempt", json=payload, timeout=5)
|
| 88 |
except Exception as e:
|
| 89 |
logger.error(f"Failed to log spoof attempt: {e}")
|
| 90 |
|
|
|
|
| 130 |
|
| 131 |
if not liveness_passed:
|
| 132 |
# LOG SPOOF ATTEMPT with lighting data
|
| 133 |
+
await log_spoof_attempt(studentId, img, liveness_score, lighting_result)
|
| 134 |
|
| 135 |
return AttendanceResponse(
|
| 136 |
studentId=None,
|