Upload app.py
Browse files
app.py
CHANGED
@@ -68,12 +68,18 @@ def predict_outcome(*args):
|
|
68 |
inputs_scaled = scaler.transform(input_data)
|
69 |
prediction = model.predict(inputs_scaled)
|
70 |
outcome_probability = prediction.flatten()[0]
|
71 |
-
|
|
|
|
|
72 |
|
73 |
inputs = [gr.Radio(label=feature_descriptions.get(feature), choices=['Yes', 'No']) if feature in categorical_features else gr.Number(label=feature_descriptions.get(feature)) for feature in features]
|
74 |
|
75 |
output_text = gr.Textbox(label="Probability of Liver Failure")
|
76 |
-
link_info = gr.Markdown(
|
77 |
|
78 |
-
iface = gr.Interface(
|
79 |
-
|
|
|
|
|
|
|
|
|
|
68 |
inputs_scaled = scaler.transform(input_data)
|
69 |
prediction = model.predict(inputs_scaled)
|
70 |
outcome_probability = prediction.flatten()[0]
|
71 |
+
prediction_text = f'Probability of Post Hepatectomy Liver Failure: {outcome_probability:.2%}'
|
72 |
+
markdown_text = "More details on the variables used in NSQIP can be found in the [NSQIP PUF User Guide 2021] (https://www.facs.org/media/wd2hlqzv/nsqip_puf_userguide_2021.pdf)."
|
73 |
+
return prediction_text, markdown_text
|
74 |
|
75 |
inputs = [gr.Radio(label=feature_descriptions.get(feature), choices=['Yes', 'No']) if feature in categorical_features else gr.Number(label=feature_descriptions.get(feature)) for feature in features]
|
76 |
|
77 |
output_text = gr.Textbox(label="Probability of Liver Failure")
|
78 |
+
link_info = gr.Markdown()
|
79 |
|
80 |
+
iface = gr.Interface(
|
81 |
+
fn=predict_outcome,
|
82 |
+
inputs=[gr.Radio(label=feature_descriptions.get(feature), choices=['Yes', 'No']) if feature in categorical_features else gr.Number(label=feature_descriptions.get(feature)) for feature in features],
|
83 |
+
outputs=[output_text, link_info],
|
84 |
+
title="NSQIP Post Hepatectomy Liver Failure Calculator"
|
85 |
+
)
|