change output
Browse files
app.py
CHANGED
|
@@ -19,9 +19,13 @@ def predict(model, input_df):
|
|
| 19 |
amputation_risk = ""
|
| 20 |
if predict_label == 1:
|
| 21 |
amputation_risk = "YES"
|
|
|
|
| 22 |
else:
|
| 23 |
amputation_risk = "NO"
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
# the parameters in this function, actually gets the inputs for the prediction
|
|
@@ -32,6 +36,7 @@ def predict_amputation(age, gender, race, diabetes_type):
|
|
| 32 |
|
| 33 |
input_df = pd.DataFrame([input_dict])
|
| 34 |
|
|
|
|
| 35 |
return str(predict(model=model, input_df=input_df)) # calls the predict function when 'submit' is clicked
|
| 36 |
|
| 37 |
|
|
@@ -60,7 +65,6 @@ iface = gr.Interface(
|
|
| 60 |
[30, "Male", "Coloured", 1],
|
| 61 |
[65, "Female", "Other", 2],
|
| 62 |
],
|
| 63 |
-
outputs.HighlightedText(color_map={"+": "lightgreen", "-": "pink", })
|
| 64 |
)
|
| 65 |
|
| 66 |
|
|
|
|
| 19 |
amputation_risk = ""
|
| 20 |
if predict_label == 1:
|
| 21 |
amputation_risk = "YES"
|
| 22 |
+
output = "<div style='background-color:green;'>"+"AMPUTATION RISK: " + amputation_risk + " SCORE: "+str(predict_score)+"</div>"
|
| 23 |
else:
|
| 24 |
amputation_risk = "NO"
|
| 25 |
+
output = "<div style='background-color:green;'>"+"AMPUTATION RISK: " + amputation_risk + " SCORE: "+str(predict_score)+"</div>"
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
return output#"AMPUTATION RISK: " + amputation_risk + " SCORE: "+str(predict_score)
|
| 29 |
|
| 30 |
|
| 31 |
# the parameters in this function, actually gets the inputs for the prediction
|
|
|
|
| 36 |
|
| 37 |
input_df = pd.DataFrame([input_dict])
|
| 38 |
|
| 39 |
+
# output
|
| 40 |
return str(predict(model=model, input_df=input_df)) # calls the predict function when 'submit' is clicked
|
| 41 |
|
| 42 |
|
|
|
|
| 65 |
[30, "Male", "Coloured", 1],
|
| 66 |
[65, "Female", "Other", 2],
|
| 67 |
],
|
|
|
|
| 68 |
)
|
| 69 |
|
| 70 |
|