Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -32,46 +32,50 @@ def log_demo_usage(text, num_entities):
|
|
32 |
|
33 |
|
34 |
# Define the Gradio interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
|
37 |
-
# Define the main demo interface
|
38 |
-
|
39 |
-
|
40 |
-
demo = gr.Interface(
|
41 |
-
fn=process_text,
|
42 |
-
inputs=gr.Textbox(
|
43 |
-
label="Paste French medical text",
|
44 |
-
placeholder="Le patient présente une hypertension artérielle...",
|
45 |
-
lines=5
|
46 |
-
),
|
47 |
-
outputs=gr.HighlightedText(),
|
48 |
-
#outputs=gr.HTML(label="Identified Medical Entities"),
|
49 |
-
title="French Healthcare NER Demo",
|
50 |
-
description="""
|
51 |
-
As featured in _Natural Language Processing on Oracle Cloud Infrastructure: Building Transformer-Based NLP Solutions Using Oracle AI and Hugging Face_.
|
52 |
-
[Get the Book](https://a.co/d/eg7my5G)
|
53 |
-
|
54 |
-
🔬 **Live Demo**: Demonstration of the French Healthcare NER model from Chapter 6 of the book.
|
55 |
-
📚 **Educational Focus**: Step-by-step guidance on model building, from design to deployment.
|
56 |
-
🏥 **Applications**: Healthcare NLP for text analysis, clinical studies, and compliance.
|
57 |
-
⚡ **Built on OCI**: Trained using Oracle Cloud Infrastructure's AI capabilities.
|
58 |
-
|
59 |
-
---
|
60 |
-
### **Disclaimer**
|
61 |
-
This is a **demo model** provided for educational purposes. It was trained on a limited dataset and is not intended for production use, clinical decision-making, or real-world medical applications.
|
62 |
-
---
|
63 |
-
_By **Hicham Assoudi** – AI Researcher (Ph.D.), Oracle Consultant, and Author._
|
64 |
-
""",
|
65 |
-
examples=[
|
66 |
-
["Le medecin donne des antibiotiques en cas d'infections des voies respiratoires e.g. pneumonie."],
|
67 |
-
["Dans le cas de l'asthme, le médecin peut recommander des corticoïdes pour réduire l'inflammation dans les poumons."],
|
68 |
-
["Pour soulager les symptômes d'allergie, le médecin prescrit des antihistaminiques."],
|
69 |
-
["Si le patient souffre de diabète de type 2, le médecin peut prescrire une insulinothérapie par exemple: Metformine 500mg."],
|
70 |
-
["Après une blessure musculaire ou une maladies douloureuses des tendons comme une tendinopathie, le patient pourrait suivre une kinésithérapie ou une physiothérapie."],
|
71 |
-
["En cas d'infection bactérienne, le médecin recommande une antibiothérapie."],
|
72 |
-
["Antécédents: infarctus du myocarde en 2019. Allergie à la pénicilline."]
|
73 |
-
]
|
74 |
-
)
|
75 |
|
76 |
# Add marketing elements
|
77 |
with gr.Blocks() as marketing_elements:
|
|
|
32 |
|
33 |
|
34 |
# Define the Gradio interface
|
35 |
+
# Create the Gradio layout
|
36 |
+
with gr.Blocks() as demo:
|
37 |
+
gr.Markdown("### French Healthcare NER Demo")
|
38 |
+
gr.Markdown(
|
39 |
+
"""
|
40 |
+
As featured in *Natural Language Processing on Oracle Cloud Infrastructure: Building Transformer-Based NLP Solutions Using Oracle AI and Hugging Face*.
|
41 |
+
"""
|
42 |
+
)
|
43 |
+
|
44 |
+
with gr.Row():
|
45 |
+
input_box = gr.Textbox(
|
46 |
+
label="Paste French medical text",
|
47 |
+
placeholder="Le patient présente une hypertension artérielle...",
|
48 |
+
lines=5
|
49 |
+
)
|
50 |
+
output_box = gr.HighlightedText(label="Identified Medical Entities")
|
51 |
+
|
52 |
+
submit_button = gr.Button("Analyze Text")
|
53 |
+
submit_button.click(fn=process_text, inputs=input_box, outputs=output_box)
|
54 |
+
|
55 |
+
gr.Markdown("### Examples")
|
56 |
+
gr.Examples(
|
57 |
+
examples=[
|
58 |
+
["Le medecin donne des antibiotiques en cas d'infections des voies respiratoires e.g. pneumonie."],
|
59 |
+
["Dans le cas de l'asthme, le médecin peut recommander des corticoïdes pour réduire l'inflammation dans les poumons."],
|
60 |
+
["Pour soulager les symptômes d'allergie, le médecin prescrit des antihistaminiques."],
|
61 |
+
["Si le patient souffre de diabète de type 2, le médecin peut prescrire une insulinothérapie par exemple: Metformine 500mg."],
|
62 |
+
["Après une blessure musculaire ou une maladies douloureuses des tendons comme une tendinopathie, le patient pourrait suivre une kinésithérapie ou une physiothérapie."],
|
63 |
+
["En cas d'infection bactérienne, le médecin recommande une antibiothérapie."],
|
64 |
+
["Antécédents: infarctus du myocarde en 2019. Allergie à la pénicilline."]
|
65 |
+
],
|
66 |
+
inputs=input_box
|
67 |
+
)
|
68 |
+
|
69 |
+
# Footer/Disclaimer section
|
70 |
+
gr.Markdown(
|
71 |
+
"""
|
72 |
+
---
|
73 |
+
### Disclaimer
|
74 |
+
This is a **demo model** provided for educational purposes. It was trained on a limited dataset and is not intended for production use, clinical decision-making, or real-world medical applications.
|
75 |
+
"""
|
76 |
+
)
|
77 |
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
# Add marketing elements
|
81 |
with gr.Blocks() as marketing_elements:
|