File size: 662 Bytes
ae467e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from pydantic import BaseModel, Field
from typing import Dict


class Prediction(BaseModel):
    predicted_class: str = Field(..., description="Predicted tumor class")
    confidence: float = Field(..., description="Confidence percentage (0-100)")
    all_predictions: Dict[str, float] = Field(..., description="Confidence scores for all classes")


class ClassificationResponse(BaseModel):
    success: bool = Field(..., description="Whether classification was successful")
    prediction: Prediction = Field(..., description="Classification results")
    message: str = Field(default="", description="Additional message or error info")