[update] one-line checking

This commit is contained in:
Nat Lee 2025-01-03 14:53:59 +08:00
parent 0f65a8765e
commit bb820a7ef4

View File

@ -131,10 +131,8 @@ def analyze(
)
# Anti-spoofing check
if anti_spoofing:
for img_obj in img_objs:
if img_obj.get("is_real", True) is False:
raise ValueError("Spoof detected in the given image.")
if anti_spoofing and any(img_obj.get("is_real", True) is False for img_obj in img_objs):
raise ValueError("Spoof detected in the given image.")
# Prepare the input for the model
valid_faces = []