GhylB commited on
Commit
9c2f1ee
·
1 Parent(s): 44df9c5

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +8 -2
main.py CHANGED
@@ -7,7 +7,7 @@ import uvicorn
7
  import os
8
  from sklearn.preprocessing import StandardScaler
9
  import joblib
10
-
11
 
12
  """ Creating the FastAPI Instance. i.e. foundation for our API,
13
  which will be the main part of our project"""
@@ -77,7 +77,13 @@ def predict_sepsis(patient: Patient):
77
  scaled_data = scaler.transform(data)
78
  parsed = predict(df=scaled_data)
79
  return {"output": parsed}
80
-
 
 
 
 
 
 
81
 
82
  if __name__ == "__main__":
83
  os.environ["DEBUG"] = "True" # Enable debug mode
 
7
  import os
8
  from sklearn.preprocessing import StandardScaler
9
  import joblib
10
+ from fastapi_swaggerui import get_swaggerui_html, get_swaggerui_settings
11
 
12
  """ Creating the FastAPI Instance. i.e. foundation for our API,
13
  which will be the main part of our project"""
 
77
  scaled_data = scaler.transform(data)
78
  parsed = predict(df=scaled_data)
79
  return {"output": parsed}
80
+
81
+ # Serve Swagger UI
82
+ app.get("/docs", include_in_schema=False)(get_swaggerui_html)
83
+ app.get(
84
+ "/docs/openapi.json",
85
+ include_in_schema=False,
86
+ )(lambda: get_swaggerui_settings(app, "/openapi.json", title="API"))
87
 
88
  if __name__ == "__main__":
89
  os.environ["DEBUG"] = "True" # Enable debug mode