File size: 511 Bytes
51e2e3c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import joblib
import numpy as np
model = joblib.load("model.pkl")
def predict(input_data):
features = [
input_data["Pregnancies"],
input_data["Glucose"],
input_data["BloodPressure"],
input_data["SkinThickness"],
input_data["Insulin"],
input_data["BMI"],
input_data["DiabetesPedigreeFunction"],
input_data["Age"]
]
X = np.array(features).reshape(1, -1)
prediction = model.predict(X)[0]
return {"prediction": int(prediction)}
|