Spaces:
Sleeping
Sleeping
Upload app.py
Browse files- src/app.py +3 -2
src/app.py
CHANGED
@@ -3,6 +3,7 @@ from pydantic import BaseModel
|
|
3 |
import pickle
|
4 |
import pandas as pd
|
5 |
|
|
|
6 |
app = FastAPI(
|
7 |
title="Sepsis Prediction API",
|
8 |
description="This FastAPI application provides sepsis predictions using a machine learning model.",
|
@@ -10,7 +11,7 @@ app = FastAPI(
|
|
10 |
)
|
11 |
|
12 |
# Load the model and key components
|
13 |
-
with open('
|
14 |
loaded_components = pickle.load(file)
|
15 |
|
16 |
loaded_model = loaded_components['model']
|
@@ -70,4 +71,4 @@ async def predict_sepsis(input_data: InputData):
|
|
70 |
if __name__ == "__main__":
|
71 |
import uvicorn
|
72 |
# Run the FastAPI application on the local host and port 8000
|
73 |
-
uvicorn
|
|
|
3 |
import pickle
|
4 |
import pandas as pd
|
5 |
|
6 |
+
# Instantiate The Fast API instance
|
7 |
app = FastAPI(
|
8 |
title="Sepsis Prediction API",
|
9 |
description="This FastAPI application provides sepsis predictions using a machine learning model.",
|
|
|
11 |
)
|
12 |
|
13 |
# Load the model and key components
|
14 |
+
with open('model_and_key_components.pkl', 'rb') as file:
|
15 |
loaded_components = pickle.load(file)
|
16 |
|
17 |
loaded_model = loaded_components['model']
|
|
|
71 |
if __name__ == "__main__":
|
72 |
import uvicorn
|
73 |
# Run the FastAPI application on the local host and port 8000
|
74 |
+
CMD ["uvicorn", "app:app", "--host", "127.0.0.1", "--port", "8000", "--reload"]
|