Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -69,14 +69,21 @@ def root():
|
|
69 |
return {"API": "This is an API for sepsis prediction."}
|
70 |
|
71 |
# Prediction endpoint (Where we will input our features)
|
72 |
-
|
73 |
-
def predict_sepsis(patient: Patient):
|
74 |
|
75 |
# Make prediction
|
76 |
-
|
77 |
-
scaled_data = scaler.transform(data)
|
78 |
-
parsed = predict(df=scaled_data)
|
79 |
-
return {"output": parsed}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
if __name__ == "__main__":
|
82 |
os.environ["DEBUG"] = "True" # Enable debug mode
|
|
|
69 |
return {"API": "This is an API for sepsis prediction."}
|
70 |
|
71 |
# Prediction endpoint (Where we will input our features)
|
72 |
+
#@app.post("/predict")
|
73 |
+
#def predict_sepsis(patient: Patient):
|
74 |
|
75 |
# Make prediction
|
76 |
+
# data = pd.DataFrame(patient.dict(), index=[0])
|
77 |
+
#scaled_data = scaler.transform(data)
|
78 |
+
#parsed = predict(df=scaled_data)
|
79 |
+
#return {"output": parsed}
|
80 |
+
|
81 |
+
|
82 |
+
@app.post("/predict")
|
83 |
+
def predict_sepsis(patient: Patient):
|
84 |
+
patient_data = patient.dict()
|
85 |
+
prediction = predict(patient_data)
|
86 |
+
return {"output": prediction}
|
87 |
|
88 |
if __name__ == "__main__":
|
89 |
os.environ["DEBUG"] = "True" # Enable debug mode
|