Files
frigate/frigate/api/defs/response/classification_response.py
T

37 lines
1.1 KiB
Python
Raw Normal View History

2025-10-08 13:55:38 -06:00
from pydantic import BaseModel, Field, RootModel
2026-07-06 09:28:02 -08:00
class FacesResponse(RootModel[dict[str, list[str]]]):
2025-10-08 13:55:38 -06:00
"""Response model for the get_faces endpoint.
Returns a mapping of face names to lists of image filenames.
Each face name corresponds to a directory in the faces folder,
and the list contains the names of image files for that face.
Example:
{
"john_doe": ["face1.webp", "face2.jpg"],
"jane_smith": ["face3.png"]
}
"""
2026-07-06 09:28:02 -08:00
root: dict[str, list[str]] = Field(
2025-10-08 13:55:38 -06:00
default_factory=dict,
description="Dictionary mapping face names to lists of image filenames",
)
class FaceRecognitionResponse(BaseModel):
"""Response model for face recognition endpoint.
Returns the result of attempting to recognize a face from an uploaded image.
"""
success: bool = Field(description="Whether the face recognition was successful")
2026-07-06 09:28:02 -08:00
score: float | None = Field(
2025-10-08 13:55:38 -06:00
default=None, description="Confidence score of the recognition (0-1)"
)
2026-07-06 09:28:02 -08:00
face_name: str | None = Field(
2025-10-08 13:55:38 -06:00
default=None, description="The recognized face name if successful"
)