xf3227 commited on
Commit
d987fcd
·
1 Parent(s): fc4b558

push, ahhhhhhh

Browse files
Files changed (1) hide show
  1. app.py +21 -10
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
- # key_mappings = {
171
- # 'NC': 'Normal cognition',
172
- # 'MCI':
173
-
174
- # }
175
-
176
- st.write("Predicted probabilities:")
177
- st.code(json.dumps(pred_dict, indent=2))
 
 
 
 
 
 
 
 
 
 
 
 
 
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)