meghanaraok commited on
Commit
a350035
1 Parent(s): 4fc0926

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -166,16 +166,15 @@ def predict_icd(text_input, model_name, label_count):
166
  label_dict = label_dict_df.set_index('icd9_code')['long_title'].to_dict()
167
  predicted_labels_float = [float(label) for label in predicted_labels]
168
  predicted_labels_with_titles = [(label, label_dict.get(str(label), "Not Found")) for label in predicted_labels_float]
169
- print("Types of keys in label_probabilities:")
170
- for key in label_probabilities.keys():
171
- print(type(key))
172
- # print("Keys in label_probabilities:", label_probabilities.keys())
173
-
174
 
175
  html_output ="<h2>ICD Codes</h2>"
 
 
 
176
  for label, title in predicted_labels_with_titles:
177
- color = hash_to_color(str(label))
178
- html_output += f"<div style='background-color: {color}; padding: 5px; margin-bottom: 5px;'>{label} - {title} <span style='float:right;'>{label_probabilities[label]:.2f}%</span></div>"
 
179
 
180
 
181
 
 
166
  label_dict = label_dict_df.set_index('icd9_code')['long_title'].to_dict()
167
  predicted_labels_float = [float(label) for label in predicted_labels]
168
  predicted_labels_with_titles = [(label, label_dict.get(str(label), "Not Found")) for label in predicted_labels_float]
 
 
 
 
 
169
 
170
  html_output ="<h2>ICD Codes</h2>"
171
+ # for label, title in predicted_labels_with_titles:
172
+ # color = hash_to_color(str(label))
173
+ # html_output += f"<div style='background-color: {color}; padding: 5px; margin-bottom: 5px;'>{label} - {title} <span style='float:right;'>{label_probabilities[label]:.2f}%</span></div>"
174
  for label, title in predicted_labels_with_titles:
175
+ label = str(label)
176
+ color = hash_to_color(label)
177
+ html_output += f"<div style='background-color: {color}; padding: 5px; margin-bottom: 5px;'>{label} - {title} <span style='float:right;'>{label_probabilities.get(label, 0):.2f}%</span></div>"
178
 
179
 
180