Upload 3 files
Browse files- app.py +16 -0
- diabetes_prediction_model.joblib +3 -0
- requirements.txt +5 -0
app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
import joblib
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
app = FastAPI()
|
| 6 |
+
model = joblib.load("diabetes_prediction_model.joblib")
|
| 7 |
+
|
| 8 |
+
@app.get("/")
|
| 9 |
+
def home():
|
| 10 |
+
return {"message": "Diabetes Prediction API"}
|
| 11 |
+
|
| 12 |
+
@app.post("/predict")
|
| 13 |
+
def predict(data: dict):
|
| 14 |
+
features = np.array(list(data.values())).reshape(1, -1)
|
| 15 |
+
prediction = int(model.predict(features)[0])
|
| 16 |
+
return {"prediction": prediction}
|
diabetes_prediction_model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0d44c927b8b3dfdd2ec20cbf0b166043360ff760048eb8bf2cae090593e33237
|
| 3 |
+
size 28011
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastapi
|
| 2 |
+
uvicorn
|
| 3 |
+
scikit-learn
|
| 4 |
+
joblib
|
| 5 |
+
numpy
|