Created
March 18, 2021 10:11
-
-
Save oscar-defelice/74f117797d058c8e8a52f8584f7d714a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
from typing import List, Optional | |
from pydantic import BaseModel | |
# Inputs | |
class InputData(BaseModel): | |
""" | |
An object to define the input data for the price estimator model. | |
It contains the features we want to use to get a prediction. | |
""" | |
CRIM: float, | |
ZN: float, | |
INDUS: float, | |
CHAS: int, | |
NOX: float, | |
RM: float, | |
AGE: float, | |
DIS: float, | |
RAD: float, | |
TAX: float, | |
PTRATIO: float, | |
B: float, | |
LSTAT": string | |
class Config: | |
schema_extra = { | |
"example": { | |
"CRIM": 0.09178, | |
"ZN": 0.0, | |
"INDUS": 4.05, | |
"CHAS": 0, | |
"NOX": 0.510, | |
"RM": 6.416, | |
"AGE": 84.1, | |
"DIS": 2.6463, | |
"RAD": 5.0, | |
"TAX": 296.0, | |
"PTRATIO": 16.6, | |
"B": 395.50, | |
"LSTAT": 9.04 | |
} | |
} | |
# Outputs | |
class RegressionItem(BaseModel): | |
""" | |
Regression output of the model. | |
""" | |
price: float | |
class ResponseDataAPI(BaseModel): | |
""" | |
The response object to be received back from the API. | |
""" | |
inputText: InputData | |
classifications: List[RegressionItem] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment