<reponame>dkarageo/image_tagger
from pydantic import BaseModel, AnyHttpUrl


class PredictionItem(BaseModel):
    """Model for each label contained in a prediction."""
    label: str
    confidence: float


class PredictionResponse(BaseModel):
    """Model to be returned when a successful prediction is performed."""
    url: AnyHttpUrl
    predictions: list[PredictionItem]


class InfoResponse(BaseModel):
    """Model to be returned when general info about the API are requested."""
    version: str
    revision: int
    description: str
    author: str
    github_url: AnyHttpUrl


class ValidationErrorDetail(BaseModel):
    loc: list[str]
    msg: str
    type: str


class ValidationErrorInfo(BaseModel):
    type: str
    detail: list[ValidationErrorDetail]


class ValidationErrorResponse(BaseModel):
    """Model for all validation error responses."""
    error: ValidationErrorInfo


class HttpErrorInfo(BaseModel):
    type: str
    detail: str


class HttpErrorResponse(BaseModel):
    """Model for all HTTP errors."""
    error: HttpErrorInfo

from pydantic import BaseModel, AnyHttpUrl


class PredictionItem(BaseModel):
    """Model for each label contained in a prediction."""
    label: str
    confidence: float


class PredictionResponse(BaseModel):
    """Model to be returned when a successful prediction is performed."""
    url: AnyHttpUrl
    predictions: list[PredictionItem]


class InfoResponse(BaseModel):
    """Model to be returned when general info about the API are requested."""
    version: str
    revision: int
    description: str
    author: str
    github_url: AnyHttpUrl


class ValidationErrorDetail(BaseModel):
    loc: list[str]
    msg: str
    type: str


class ValidationErrorInfo(BaseModel):
    type: str
    detail: list[ValidationErrorDetail]


class ValidationErrorResponse(BaseModel):
    """Model for all validation error responses."""
    error: ValidationErrorInfo


class HttpErrorInfo(BaseModel):
    type: str
    detail: str


class HttpErrorResponse(BaseModel):
    """Model for all HTTP errors."""
    error: HttpErrorInfo
Model for each label contained in a prediction. Model to be returned when a successful prediction is performed. Model to be returned when general info about the API are requested. Model for all validation error responses. Model for all HTTP errors.