Spaces:
Runtime error
Runtime error
lyangas
commited on
Commit
•
08004fd
1
Parent(s):
bf0a8c0
add message for voiting; add probability in result of /predict_code
Browse files
app.py
CHANGED
@@ -139,11 +139,14 @@ def predict_api():
|
|
139 |
pred_groups = classify_group(text, top_n)
|
140 |
pred_codes_top = get_top_result(pred_codes)
|
141 |
pred_groups_top = get_top_result(pred_groups)
|
|
|
|
|
|
|
142 |
result = {
|
143 |
"icd10":
|
144 |
-
{'result': pred_codes_top, 'details': pred_codes},
|
145 |
"dx_group":
|
146 |
-
{'result': pred_groups_top, 'details': pred_groups}
|
147 |
}
|
148 |
return result
|
149 |
|
@@ -166,7 +169,12 @@ def predict_code_api():
|
|
166 |
top_pred_code, pred_codes, all_codes_in_group = classify_code_by_group(text, group_name, top_n)
|
167 |
result = {
|
168 |
"icd10":
|
169 |
-
{
|
|
|
|
|
|
|
|
|
|
|
170 |
}
|
171 |
return result
|
172 |
|
|
|
139 |
pred_groups = classify_group(text, top_n)
|
140 |
pred_codes_top = get_top_result(pred_codes)
|
141 |
pred_groups_top = get_top_result(pred_groups)
|
142 |
+
|
143 |
+
message_codes = 'models agree' if pred_codes_top is not None else 'models disagree'
|
144 |
+
message_group = 'models agree' if pred_groups_top is not None else 'models disagree'
|
145 |
result = {
|
146 |
"icd10":
|
147 |
+
{'result': pred_codes_top, 'details': pred_codes, 'message': message_codes},
|
148 |
"dx_group":
|
149 |
+
{'result': pred_groups_top, 'details': pred_groups, 'message': message_group},
|
150 |
}
|
151 |
return result
|
152 |
|
|
|
169 |
top_pred_code, pred_codes, all_codes_in_group = classify_code_by_group(text, group_name, top_n)
|
170 |
result = {
|
171 |
"icd10":
|
172 |
+
{
|
173 |
+
'result': top_pred_code,
|
174 |
+
'probability': pred_codes[top_pred_code],
|
175 |
+
'details': pred_codes,
|
176 |
+
'all_codes': all_codes_in_group
|
177 |
+
}
|
178 |
}
|
179 |
return result
|
180 |
|