NewtonKimathi commited on
Commit
5c9dd7e
·
1 Parent(s): a50c3df

Sepsis Prediction Fast API

Browse files
Files changed (1) hide show
  1. main.py +17 -3
main.py CHANGED
@@ -1,5 +1,17 @@
1
 
2
-
 
 
 
 
 
 
 
 
 
 
 
 
3
  # Setup Section
4
 
5
  # Create FastAPI instance
@@ -63,7 +75,7 @@ def index():
63
  @app.post("/predict")
64
  def predict (df:InputData):
65
 
66
-
67
  # Prepare the feature and structure them like in the notebook
68
  df = pd.DataFrame([df.dict().values()],columns=df.dict().keys())
69
 
@@ -87,7 +99,9 @@ def predict (df:InputData):
87
 
88
 
89
  if __name__ == "__main__":
90
- uvicorn.run("main:app",reload=True)
 
 
91
 
92
 
93
 
 
1
 
2
+ # Importations
3
+
4
+ from typing import Union
5
+ from fastapi import FastAPI
6
+ import pickle
7
+ from pydantic import BaseModel
8
+ import pandas as pd
9
+ import os
10
+ import uvicorn
11
+ from fastapi import HTTPException, status
12
+
13
+ from sklearn.preprocessing import StandardScaler
14
+ from sklearn.preprocessing import LabelEncoder
15
  # Setup Section
16
 
17
  # Create FastAPI instance
 
75
  @app.post("/predict")
76
  def predict (df:InputData):
77
 
78
+
79
  # Prepare the feature and structure them like in the notebook
80
  df = pd.DataFrame([df.dict().values()],columns=df.dict().keys())
81
 
 
99
 
100
 
101
  if __name__ == "__main__":
102
+ uvicorn.run("main:app", host="0.0.0.0", port=7860, reload=True)
103
+
104
+
105
 
106
 
107