shifted predict code
Browse files
app.py
CHANGED
|
@@ -23,16 +23,16 @@ def predict(model, input_df):
|
|
| 23 |
|
| 24 |
#input_dict = {"AGE": age, "GENDER_F": gender, "RACE_Asian": ,"RACE_Black": , "RACE_Coloured":, "RACE_Other":, "RACE_White":, "DIABETES_CLASS_Type 1 diabetes":}
|
| 25 |
|
| 26 |
-
input_dict = {"AGE": 70.0, "GENDER_F": 0.0, "RACE_Asian": 1.0, "RACE_Black": 0.0, "RACE_Coloured": 0.0, "RACE_Other": 0.0, "RACE_White": 0.0, "DIABETES_CLASS_Type 1 diabetes":0.0}
|
| 27 |
|
| 28 |
|
| 29 |
-
input_df = pd.DataFrame([input_dict])
|
| 30 |
-
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
# the parameters in this function, actually gets the inputs for the prediction
|
| 35 |
def predict_amputation(age, gender, race, diabetes_type):
|
|
|
|
|
|
|
|
|
|
| 36 |
return "ALLAH"+predict(model=model, input_df=input_df) # calls the predict function when the 'submit' button is clicked
|
| 37 |
|
| 38 |
|
|
@@ -40,11 +40,16 @@ title = "DIabetes-related Amputation Risk Calculator (DIARC)"
|
|
| 40 |
|
| 41 |
description = "A diabetes-related amputation machine learning model trained on the diabetes dataset from the Inkosi Albert Luthuli Central Hospital (IALCH) in Durban, KwaZulu-Natal, South Africa."
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
iface = gr.Interface(
|
| 45 |
fn=predict_amputation,
|
| 46 |
title=title,
|
| 47 |
description=description,
|
|
|
|
| 48 |
inputs=[gr.inputs.Slider(minimum=0,maximum=100, step=1, label="Age"), gr.inputs.Dropdown(["Female", "Male"], default="Male", label="Gender"), gr.inputs.Dropdown(["Asian", "Black", "Coloured", "White", "Other"], default="Asian", label="Race"), gr.inputs.Dropdown(["1", "2"], default="1", label="Diabetes Type")],
|
| 49 |
outputs="text",
|
| 50 |
theme="darkhuggingface",
|
|
|
|
| 23 |
|
| 24 |
#input_dict = {"AGE": age, "GENDER_F": gender, "RACE_Asian": ,"RACE_Black": , "RACE_Coloured":, "RACE_Other":, "RACE_White":, "DIABETES_CLASS_Type 1 diabetes":}
|
| 25 |
|
|
|
|
| 26 |
|
| 27 |
|
|
|
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
# the parameters in this function, actually gets the inputs for the prediction
|
| 32 |
def predict_amputation(age, gender, race, diabetes_type):
|
| 33 |
+
input_dict = {"AGE": 70.0, "GENDER_F": 0.0, "RACE_Asian": 1.0, "RACE_Black": 0.0, "RACE_Coloured": 0.0, "RACE_Other": 0.0, "RACE_White": 0.0, "DIABETES_CLASS_Type 1 diabetes":0.0}
|
| 34 |
+
|
| 35 |
+
input_df = pd.DataFrame([input_dict])
|
| 36 |
return "ALLAH"+predict(model=model, input_df=input_df) # calls the predict function when the 'submit' button is clicked
|
| 37 |
|
| 38 |
|
|
|
|
| 40 |
|
| 41 |
description = "A diabetes-related amputation machine learning model trained on the diabetes dataset from the Inkosi Albert Luthuli Central Hospital (IALCH) in Durban, KwaZulu-Natal, South Africa."
|
| 42 |
|
| 43 |
+
article = "<p style='text-align: center'>Copyright (C) 2021. All Rights Reserved.</p>"
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
| 47 |
|
| 48 |
iface = gr.Interface(
|
| 49 |
fn=predict_amputation,
|
| 50 |
title=title,
|
| 51 |
description=description,
|
| 52 |
+
article=article,
|
| 53 |
inputs=[gr.inputs.Slider(minimum=0,maximum=100, step=1, label="Age"), gr.inputs.Dropdown(["Female", "Male"], default="Male", label="Gender"), gr.inputs.Dropdown(["Asian", "Black", "Coloured", "White", "Other"], default="Asian", label="Race"), gr.inputs.Dropdown(["1", "2"], default="1", label="Diabetes Type")],
|
| 54 |
outputs="text",
|
| 55 |
theme="darkhuggingface",
|