Download model.py from jaik256/diebateRandomForest1: direct link, hf CLI and curl.
- Browser
- Download file 511 Bytes
-
https://huggingface.co/jaik256/diebateRandomForest1/resolve/main/model.py
- Command line
-
hf download hf://jaik256/diebateRandomForest1/model.py
-
curl -L -o model.py https://huggingface.co/jaik256/diebateRandomForest1/resolve/main/model.py
511 Bytes
| 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)} | |