Source code for luna_handlers.classes.schemas.detector

"""
Module contains schemas for detector handler
"""
from pydantic import root_validator

from classes.schemas.handler import FaceInputEstimationsModel


[docs]class Detector(FaceInputEstimationsModel): """Model for detector handler with urls or samples"""
[docs] @staticmethod def checkRequiredFaceBBox(values): """Check required face bounding box for incoming image""" if values["image"] is not None and values["faceBoundingBoxes"] is None: raise ValueError("Error path: '('face_bounding_boxes',)'. Error msg: 'field required'")
[docs] @root_validator(skip_on_failure=True) def validateHandler(cls, values: dict) -> dict: cls.checkRequiredFaceBBox(values) return super().validateHandler(values)