add .pkl file for model and predictions code
Browse files- app.py +28 -2
- tuned_blend_specific_model_19112021.pkl +0 -0
app.py
CHANGED
|
@@ -3,10 +3,36 @@
|
|
| 3 |
|
| 4 |
|
| 5 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
def predict_amputation(age, gender, race, diabetes_type):
|
| 8 |
-
return "ALLAH"
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
title = "DIabetes-related Amputation Risk Calculator (DIARC)"
|
|
|
|
| 3 |
|
| 4 |
|
| 5 |
import gradio as gr
|
| 6 |
+
from pycaret.classification import load_model, predict_model
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# load the trained model for predictions
|
| 11 |
+
model = load_model("tuned_blend_specific_model_19112021")
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
# define the function to call
|
| 15 |
+
def predict(model, input_df):
|
| 16 |
+
predictions_df = predict_model(estimator=model, data=input_df)
|
| 17 |
+
predictions = predictions_df["Amputation"][0]
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
#input_dict = {"AGE": age, "GENDER_F": gender, "RACE_Asian": ,"RACE_Black": , "RACE_Coloured":, "RACE_Other":, "RACE_White":, "DIABETES_CLASS_Type 1 diabetes":}
|
| 24 |
+
|
| 25 |
+
input_dict = {"AGE": 70.0, "GENDER_F": 0.0, "RACE_Asian": 1.0, "RACE_Black": , "RACE_Coloured": 0.0, "RACE_Other": 0.0, "RACE_White": 0.0, "DIABETES_CLASS_Type 1 diabetes":0.0}
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
input_df = pd.DataFrame([input_dict])
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
# the parameters in this function, actually gets the inputs for the prediction
|
| 34 |
+
def predict_amputation(age, gender, race, diabetes_type):
|
| 35 |
+
return "ALLAH"+predict(model=model, input_df=input_df) # calls the predict function when the 'submit' button is clicked
|
| 36 |
|
| 37 |
|
| 38 |
title = "DIabetes-related Amputation Risk Calculator (DIARC)"
|
tuned_blend_specific_model_19112021.pkl
ADDED
|
Binary file (4.88 MB). View file
|
|
|