Files

43 lines
860 B
Python
Raw Permalink Normal View History

from typing import List, Optional
from pydantic import BaseModel # pydantic v1
class DefectBoxSchema(BaseModel):
class_id: int
class_name: str
class_name_zh: str
confidence: float
severity: str
box_xyxy: List[float]
class DetectResponse(BaseModel):
task_id: str
verdict: str # pass | fail
defect_count: int
max_severity: str
avg_confidence: float
duration_ms: float
image_width: int
image_height: int
model_version: str
defects: List[DefectBoxSchema]
annotated_image_base64: Optional[str] = None
class ReloadRequest(BaseModel):
model_path: str
runtime: str = "ultralytics"
class ReloadResponse(BaseModel):
status: str
model_version: str
class HealthResponse(BaseModel):
status: str
model_version: str
runtime: str
device: str