push, ahhhhhhh
Browse files
app.py
CHANGED
@@ -30,7 +30,6 @@ def load_model():
|
|
30 |
return model
|
31 |
|
32 |
model = load_model()
|
33 |
-
print(dir(model))
|
34 |
|
35 |
def predict_proba(data_dict):
|
36 |
pred_dict = model.predict_proba([data_dict])[1][0]
|
@@ -166,12 +165,24 @@ if predict_button:
|
|
166 |
data_dict = convert_dictionary(data_dict, nacc_mapping)
|
167 |
pred_dict = predict_proba(data_dict)
|
168 |
|
169 |
-
# change key name
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
return model
|
31 |
|
32 |
model = load_model()
|
|
|
33 |
|
34 |
def predict_proba(data_dict):
|
35 |
pred_dict = model.predict_proba([data_dict])[1][0]
|
|
|
165 |
data_dict = convert_dictionary(data_dict, nacc_mapping)
|
166 |
pred_dict = predict_proba(data_dict)
|
167 |
|
168 |
+
# change key name and value representations
|
169 |
+
key_mappings = {
|
170 |
+
'NC': 'Normal cognition',
|
171 |
+
'MCI': 'Mild cognitive impairment',
|
172 |
+
'DE': 'Dementia',
|
173 |
+
'AD': 'Alzheimer\'s disease',
|
174 |
+
'LBD': 'Lewy bodies and Parkinson\'s disease',
|
175 |
+
'VD': 'Vascular brain injury or vascular dementia including stroke',
|
176 |
+
'PRD': 'Prion disease including Creutzfeldt-Jakob disease',
|
177 |
+
'FTD': 'Frontotemporal lobar degeneration',
|
178 |
+
'NPH': 'Normal pressure hydrocephalus',
|
179 |
+
'SEF': 'Systemic and external factors',
|
180 |
+
'PSY': 'Psychiatric diseases',
|
181 |
+
'TBI': 'Traumatic brain injury',
|
182 |
+
'ODE': 'Other causes which include neoplasms, multiple systems atrophy, essential tremor, Huntington\'s disease, Down syndrome, and seizures'
|
183 |
+
}
|
184 |
+
pred_dict = {key_mappings[k]: f"{v * 100:.2f}%" for k, v in pred_dict.items()}
|
185 |
+
|
186 |
+
st.write("Predictions")
|
187 |
+
df = pd.DataFrame(list(pred_dict.items()), columns=['Label', 'Probability'])
|
188 |
+
st.table(df)
|