Spaces:
Sleeping
Sleeping
Update app.py
#2
by
meghanaraok
- opened
app.py
CHANGED
@@ -166,9 +166,6 @@ def predict_icd(text_input, model_name, label_count):
|
|
166 |
predicted_labels_with_titles = [(label, label_dict.get(str(label), "Not Found")) for label in predicted_labels]
|
167 |
|
168 |
html_output ="<h2>ICD Codes</h2>"
|
169 |
-
# for label, title in predicted_labels_with_titles:
|
170 |
-
# color = hash_to_color(str(label))
|
171 |
-
# 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>"
|
172 |
for label, title in predicted_labels_with_titles:
|
173 |
label = str(label)
|
174 |
color = hash_to_color(label)
|
@@ -202,8 +199,8 @@ with gr.Blocks() as demo:
|
|
202 |
|
203 |
model = gr.Radio(["HiLAT", "ClinicalLongformer", "Long-LAT", "Long-HiLAT"], label="Model", info="Select the model used for prediction")
|
204 |
label_count = gr.Radio(["5", "50"],label = "ICD Code Prediction Range", info="Select the number of top ICD codes to predict: either the top 5 or the top 50")
|
205 |
-
output = gr.HTML(label="ICD Codes")
|
206 |
predict_btn = gr.Button("Predict")
|
|
|
207 |
predict_btn.click(fn = predict_icd, inputs=[text_input, model, label_count], outputs=[output])
|
208 |
|
209 |
demo.launch(debug= True, share=True)
|
|
|
166 |
predicted_labels_with_titles = [(label, label_dict.get(str(label), "Not Found")) for label in predicted_labels]
|
167 |
|
168 |
html_output ="<h2>ICD Codes</h2>"
|
|
|
|
|
|
|
169 |
for label, title in predicted_labels_with_titles:
|
170 |
label = str(label)
|
171 |
color = hash_to_color(label)
|
|
|
199 |
|
200 |
model = gr.Radio(["HiLAT", "ClinicalLongformer", "Long-LAT", "Long-HiLAT"], label="Model", info="Select the model used for prediction")
|
201 |
label_count = gr.Radio(["5", "50"],label = "ICD Code Prediction Range", info="Select the number of top ICD codes to predict: either the top 5 or the top 50")
|
|
|
202 |
predict_btn = gr.Button("Predict")
|
203 |
+
output = gr.HTML(label="ICD Codes")
|
204 |
predict_btn.click(fn = predict_icd, inputs=[text_input, model, label_count], outputs=[output])
|
205 |
|
206 |
demo.launch(debug= True, share=True)
|