Commit
·
206327a
1
Parent(s):
14508ad
Update main.py
Browse files
main.py
CHANGED
@@ -12,6 +12,7 @@ from sklearn.preprocessing import StandardScaler
|
|
12 |
from sklearn.compose import ColumnTransformer
|
13 |
from sklearn.feature_selection import f_classif
|
14 |
|
|
|
15 |
app = FastAPI()
|
16 |
templates = Jinja2Templates(directory="templates")
|
17 |
|
@@ -31,11 +32,16 @@ model_input = joblib.load("model_1.joblib")
|
|
31 |
@app.post("/sepsis_prediction")
|
32 |
async def predict(input: InputFeatures):
|
33 |
# Numeric Features
|
34 |
-
|
35 |
['Plasma_glucose', 'Blood_Work_Result_1', 'Blood_Pressure',
|
36 |
'Blood_Work_Result_2', 'Blood_Work_Result_3', 'Body_mass_index',
|
37 |
-
'Blood_Work_Result_4', 'patients_age']
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
XGB = Pipeline([
|
41 |
("col_trans", full_pipeline), # You need to define full_pipeline
|
|
|
12 |
from sklearn.compose import ColumnTransformer
|
13 |
from sklearn.feature_selection import f_classif
|
14 |
|
15 |
+
|
16 |
app = FastAPI()
|
17 |
templates = Jinja2Templates(directory="templates")
|
18 |
|
|
|
32 |
@app.post("/sepsis_prediction")
|
33 |
async def predict(input: InputFeatures):
|
34 |
# Numeric Features
|
35 |
+
num_attr = [
|
36 |
['Plasma_glucose', 'Blood_Work_Result_1', 'Blood_Pressure',
|
37 |
'Blood_Work_Result_2', 'Blood_Work_Result_3', 'Body_mass_index',
|
38 |
+
'Blood_Work_Result_4', 'patients_age']]
|
39 |
+
|
40 |
+
#creating pipelines
|
41 |
+
num_pipeline= Pipeline([('imputer', SimpleImputer()),('scaler', StandardScaler())])
|
42 |
+
|
43 |
+
|
44 |
+
full_pipeline=ColumnTransformer([('num_pipe',num_pipeline,num_attr)])
|
45 |
|
46 |
XGB = Pipeline([
|
47 |
("col_trans", full_pipeline), # You need to define full_pipeline
|