File size: 729 Bytes
51e944e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from pydantic import BaseModel, Field
from enum import Enum
from typing import List
import datetime

# Response Models
class Prediction(BaseModel):
    """Single prediction result schema."""
    label: str
    confidence: float = Field(..., ge=0.0, le=100.0)  

class ApiResponse(BaseModel):
    """API response schema for prediction endpoint."""
    predictions: List[Prediction]
    model_version: str
    inference_time: float
    timestamp: str

class HealthCheckResponse(BaseModel):
    """Health check response schema."""
    status: str
    models_loaded: List[str]
    timestamp: str

# Enums
class ModelName(str, Enum):
    """Supported model names enumeration."""
    efficientnet = "efficientnet"
    resnet = "resnet"