Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,6 +72,7 @@ def adr_predict(x):
|
|
| 72 |
htext = "<p style='color: black;'>NER processing error.</p>"
|
| 73 |
|
| 74 |
label_output = {"Severe Reaction": float(scores[1]), "Non-severe Reaction": float(scores[0])}
|
|
|
|
| 75 |
return label_output, local_plot, htext
|
| 76 |
|
| 77 |
# FIX: Added !important tags to ensure Gradio's dark mode doesn't override the white background and black text
|
|
@@ -86,7 +87,7 @@ with gr.Blocks(title="ADR Detector") as demo:
|
|
| 86 |
with gr.Column(elem_classes="main-header"):
|
| 87 |
gr.Markdown("# Adverse Drug Reaction (ADR) Detector")
|
| 88 |
gr.Markdown("Analyze clinical text for potential medication-related severity and key medical entities.")
|
| 89 |
-
|
| 90 |
with gr.Row():
|
| 91 |
with gr.Column(scale=1):
|
| 92 |
gr.Markdown("### Input")
|
|
@@ -106,20 +107,23 @@ with gr.Blocks(title="ADR Detector") as demo:
|
|
| 106 |
],
|
| 107 |
inputs=[prob1]
|
| 108 |
)
|
| 109 |
-
|
| 110 |
with gr.Column(scale=1):
|
| 111 |
gr.Markdown("### Classification")
|
| 112 |
label = gr.Label(label="Severity Probability")
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
gr.Markdown("---")
|
| 121 |
gr.Markdown("Disclaimer: This tool is for research purposes only and does not constitute medical advice.")
|
| 122 |
-
|
| 123 |
submit_btn.click(
|
| 124 |
fn=adr_predict,
|
| 125 |
inputs=[prob1],
|
|
|
|
| 72 |
htext = "<p style='color: black;'>NER processing error.</p>"
|
| 73 |
|
| 74 |
label_output = {"Severe Reaction": float(scores[1]), "Non-severe Reaction": float(scores[0])}
|
| 75 |
+
|
| 76 |
return label_output, local_plot, htext
|
| 77 |
|
| 78 |
# FIX: Added !important tags to ensure Gradio's dark mode doesn't override the white background and black text
|
|
|
|
| 87 |
with gr.Column(elem_classes="main-header"):
|
| 88 |
gr.Markdown("# Adverse Drug Reaction (ADR) Detector")
|
| 89 |
gr.Markdown("Analyze clinical text for potential medication-related severity and key medical entities.")
|
| 90 |
+
|
| 91 |
with gr.Row():
|
| 92 |
with gr.Column(scale=1):
|
| 93 |
gr.Markdown("### Input")
|
|
|
|
| 107 |
],
|
| 108 |
inputs=[prob1]
|
| 109 |
)
|
| 110 |
+
|
| 111 |
with gr.Column(scale=1):
|
| 112 |
gr.Markdown("### Classification")
|
| 113 |
label = gr.Label(label="Severity Probability")
|
| 114 |
|
| 115 |
+
# --- TABS REMOVED HERE ---
|
| 116 |
+
# Both components are now stacked sequentially in the column
|
| 117 |
+
|
| 118 |
+
gr.Markdown("### Medical Entities")
|
| 119 |
+
htext = gr.HTML(label="NER Mapping", elem_classes="output-box")
|
| 120 |
+
|
| 121 |
+
gr.Markdown("### Model Logic (SHAP)")
|
| 122 |
+
local_plot = gr.HTML(label='Feature Importance', elem_classes="output-box")
|
| 123 |
|
| 124 |
gr.Markdown("---")
|
| 125 |
gr.Markdown("Disclaimer: This tool is for research purposes only and does not constitute medical advice.")
|
| 126 |
+
|
| 127 |
submit_btn.click(
|
| 128 |
fn=adr_predict,
|
| 129 |
inputs=[prob1],
|