Spaces:
Runtime error
Runtime error
Updated the default values for the containers and placed the description string outside of the interface function
Browse files
app.py
CHANGED
@@ -83,79 +83,76 @@ def predict(age, female, race, elective, aweekend, zipinc_qrtl, hosp_region, hos
|
|
83 |
'Predicting Death Outcome:': pred['Label'][0]}
|
84 |
|
85 |
# Defining the containers for each input
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
# Defining and launching the interface
|
134 |
iface = gr.Interface(
|
135 |
fn = predict,
|
136 |
-
inputs =
|
137 |
-
hosp_bedsize, h_contrl, pay, anemia, atrial_fibrillation,
|
138 |
-
cancer, cardiac_arrhythmias, carotid_artery_disease,
|
139 |
-
chronic_kidney_disease, chronic_pulmonary_disease, coagulopathy,
|
140 |
-
depression, diabetes_mellitus, drug_abuse, dyslipidemia, endocarditis,
|
141 |
-
family_history, fluid_and_electrolyte_disorder, heart_failure,
|
142 |
-
hypertension, known_cad, liver_disease, obesity, peripheral_vascular_disease,
|
143 |
-
prior_cabg, prior_icd, prior_mi, prior_pci, prior_ppm, prior_tia_stroke,
|
144 |
-
pulmonary_circulation_disorder, smoker, valvular_disease, weight_loss,
|
145 |
-
endovascular_tavr, transapical_tavr],
|
146 |
outputs = 'text',
|
147 |
live=True,
|
148 |
title = "Predicting In-Hospital Mortality After TAVR Using Preoperative Variables and Penalized Logistic Regression",
|
149 |
-
description =
|
150 |
-
<p style="font-size:16px; line-height:1.6;">
|
151 |
-
This app predicts in-hospital mortality after TAVR using a finalized logistic regression model with L2 penalty, based on national inpatient data from 2012–2019 (HCUP NIS).<br>
|
152 |
-
<br>
|
153 |
-
Published paper:
|
154 |
-
<a href="https://www.nature.com/articles/s41598-023-37358-9.pdf" target="_blank">
|
155 |
-
Alhwiti, T., Aldrugh, S., & Megahed, F. M. (2023), <i>Scientific Reports</i>, 13(1), 10252.
|
156 |
-
</a>
|
157 |
-
</p>
|
158 |
-
""",
|
159 |
css = 'https://bootswatch.com/5/journal/bootstrap.css')
|
160 |
|
161 |
iface.launch()
|
|
|
83 |
'Predicting Death Outcome:': pred['Label'][0]}
|
84 |
|
85 |
# Defining the containers for each input
|
86 |
+
inputs = [
|
87 |
+
gr.Slider(minimum=18, maximum=100, value=80, label="Age"),
|
88 |
+
gr.Dropdown(choices=["Female", "Male"], value="Female", label="Sex"),
|
89 |
+
gr.Dropdown(choices=['Asian or Pacific Islander', 'Black', 'Hispanic', 'Native American', 'White', 'Other'], value='White', label='Race'),
|
90 |
+
gr.Radio(choices=['Elective', 'NonElective'], value='Elective', label='Elective'),
|
91 |
+
gr.Radio(choices=["No", "Yes"], value="No", label='Weekend'),
|
92 |
+
gr.Radio(choices=['FirstQ', 'SecondQ', 'ThirdQ', 'FourthQ'], value='SecondQ', label='Zip Income Quartile'),
|
93 |
+
gr.Radio(choices=['Midwest', 'Northeast', 'South', 'West'], value='South', label='Hospital Region'),
|
94 |
+
gr.Radio(choices=['New England', 'Middle Atlantic', 'East North Central', 'West North Central', 'South Atlantic', 'East South Central', 'West South Central', 'Mountain', 'Pacific'], value='South Atlantic', label='Hospital Division'),
|
95 |
+
gr.Radio(choices=['Urban teaching', 'Urban nonteaching', 'Rural'], value='Urban teaching', label='Hospital Location/Teaching'),
|
96 |
+
gr.Radio(choices=['Small', 'Medium', 'Large'], value='Large', label='Hospital Bedsize'),
|
97 |
+
gr.Radio(choices=['Government_nonfederal', 'Private_invest_own', 'Private_not_profit'], value='Private_not_profit', label='Hospital Control'),
|
98 |
+
gr.Dropdown(choices=['Private insurance', 'Medicare', 'Medicaid', 'Self-pay', 'No charge', 'Other'], value='Medicare', label='Payee'),
|
99 |
+
|
100 |
+
# Comorbidities — default to "No" with some "Yes" for making the default selection more aesthetically pleasing
|
101 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Anemia'),
|
102 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Atrial Fibrillation'),
|
103 |
+
gr.Radio(choices=["No", "Yes"], value="No", label='Cancer'),
|
104 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Cardiac Arrhythmias'),
|
105 |
+
gr.Radio(choices=["No", "Yes"], value="No", label='Carotid Artery Disease'),
|
106 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Chronic Kidney Disease'),
|
107 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Chronic Pulmonary Disease'),
|
108 |
+
gr.Radio(choices=["No", "Yes"], value="No", label='Coagulopathy'),
|
109 |
+
gr.Radio(choices=["No", "Yes"], value="No", label='Depression'),
|
110 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Diabetes Mellitus'),
|
111 |
+
gr.Radio(choices=["No", "Yes"], value="No", label='Drug Abuse'),
|
112 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Dyslipidemia'),
|
113 |
+
gr.Radio(choices=["No", "Yes"], value="No", label='Endocarditis'),
|
114 |
+
gr.Radio(choices=["No", "Yes"], value="No", label='Family History'),
|
115 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Fluid and Electrolyte Disorder'),
|
116 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Heart Failure'),
|
117 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Hypertension'),
|
118 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Known CAD'),
|
119 |
+
gr.Radio(choices=["No", "Yes"], value="No", label='Liver Disease'),
|
120 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Obesity'),
|
121 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Peripheral Vascular Disease'),
|
122 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Prior CABG'),
|
123 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Prior ICD'),
|
124 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Prior MI'),
|
125 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Prior PCI'),
|
126 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Prior PPM'),
|
127 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Prior TIA Stroke'),
|
128 |
+
gr.Radio(choices=["No", "Yes"], value="No", label='Pulmonary Circulation Disorder'),
|
129 |
+
gr.Radio(choices=["No", "Yes"], value="No", label='Smoker'),
|
130 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Valvular Disease'),
|
131 |
+
gr.Radio(choices=["No", "Yes"], value="No", label='Weight Loss'),
|
132 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Endovascular TAVR'),
|
133 |
+
gr.Radio(choices=["No", "Yes"], value="Yes", label='Transapical TAVR')
|
134 |
+
]
|
135 |
+
|
136 |
+
# The app's first few descriptive lines
|
137 |
+
description_html = """
|
138 |
+
<p style="font-size:16px; line-height:1.6;">
|
139 |
+
This app predicts in-hospital mortality after TAVR using a finalized logistic regression model with L2 penalty, based on national inpatient data from 2012–2019 (HCUP NIS).<br>
|
140 |
+
<br>
|
141 |
+
Published paper:
|
142 |
+
<a href="https://www.nature.com/articles/s41598-023-37358-9.pdf" target="_blank">
|
143 |
+
Alhwiti, T., Aldrugh, S., & Megahed, F. M. (2023), <i>Scientific Reports</i>
|
144 |
+
</a>
|
145 |
+
</p>
|
146 |
+
"""
|
147 |
|
148 |
# Defining and launching the interface
|
149 |
iface = gr.Interface(
|
150 |
fn = predict,
|
151 |
+
inputs = inputs,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
outputs = 'text',
|
153 |
live=True,
|
154 |
title = "Predicting In-Hospital Mortality After TAVR Using Preoperative Variables and Penalized Logistic Regression",
|
155 |
+
description = description_html,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
css = 'https://bootswatch.com/5/journal/bootstrap.css')
|
157 |
|
158 |
iface.launch()
|