-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemas.py
More file actions
36 lines (31 loc) · 920 Bytes
/
schemas.py
File metadata and controls
36 lines (31 loc) · 920 Bytes
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
30
31
32
33
34
35
36
from pydantic import BaseModel
from typing import Dict, List, Union # Added missing imports
class PredictionResponse(BaseModel):
predicted_class: str
confidence: float
description: str
properties: List[str] # Now List is properly imported
color: str
all_confidences: Dict[str, Dict[str, Union[float, str]]]
class FertilizerRequest(BaseModel):
Temperature: float
Humidity: float
Moisture: float
Soil_Type: str
Crop_Type: str
Nitrogen: float
Potassium: float
Phosphorous: float
class Config:
schema_extra = {
"example": {
"Temperature": 25,
"Humidity": 60,
"Moisture": 25,
"Soil_Type": "Loamy",
"Crop_Type": "Maize",
"Nitrogen": 20,
"Potassium": 30,
"Phosphorous": 15
}
}