Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- models/requests.py +12 -0
- models/responses.py +11 -0
models/requests.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Dict
|
| 2 |
+
from pydantic import BaseModel
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class PredictRequest(BaseModel):
|
| 6 |
+
"""Request model for /predict endpoint.
|
| 7 |
+
|
| 8 |
+
Contains a mapping of feature names to numeric values that the model
|
| 9 |
+
will consume. Keep it minimal so imports from `models.requests`
|
| 10 |
+
succeed when the app starts.
|
| 11 |
+
"""
|
| 12 |
+
features: Dict[str, float]
|
models/responses.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Dict, List, Optional
|
| 2 |
+
from pydantic import BaseModel
|
| 3 |
+
|
| 4 |
+
class PredictResponse(BaseModel):
|
| 5 |
+
label: str
|
| 6 |
+
probabilities: Optional[Dict[str, float]] = None
|
| 7 |
+
recognized: List[str]
|
| 8 |
+
unknown: List[str]
|
| 9 |
+
missing: List[str]
|
| 10 |
+
feature_order: List[str]
|
| 11 |
+
engineered: Dict[str, Optional[float]]
|