hassoudi commited on
Commit
c87d13e
·
verified ·
1 Parent(s): a0e86e6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -45
app.py CHANGED
@@ -30,51 +30,42 @@ def log_demo_usage(text, num_entities):
30
 
31
 
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
 
30
 
31
 
32
 
33
+ # Define the main demo interface
34
+
35
+
36
+ demo = gr.Interface(
37
+ fn=process_text,
38
+ inputs=gr.Textbox(
39
+ label="Paste French medical text",
40
+ placeholder="Le patient présente une hypertension artérielle...",
41
+ lines=5
42
+ ),
43
+ outputs=gr.HighlightedText(),
44
+ #outputs=gr.HTML(label="Identified Medical Entities"),
45
+ title="French Healthcare NER Demo",
46
+ description="""
47
+ _By **Hicham Assoudi** AI Researcher (Ph.D.), Oracle Consultant, and Author._
48
+ ---
49
+ As featured in _Natural Language Processing on Oracle Cloud Infrastructure: Building Transformer-Based NLP Solutions Using Oracle AI and Hugging Face_. [Get the Book](https://a.co/d/eg7my5G)
50
+ 🔬 **Live Demo**: Demonstration of the French Healthcare NER model from Chapter 6 of the book.
51
+ 📚 **Educational Focus**: Step-by-step guidance on model building, from design to deployment.
52
+ 🏥 **Applications**: Healthcare NLP for text analysis, clinical studies, and compliance.
53
+ **Built on OCI**: Trained using Oracle Cloud Infrastructure's AI capabilities.
54
+ """,
55
+ article="""
56
+ ### **Disclaimer**
57
+ 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.
58
+ """,
59
+ examples=[
60
+ ["Le medecin donne des antibiotiques en cas d'infections des voies respiratoires e.g. pneumonie."],
61
+ ["Dans le cas de l'asthme, le médecin peut recommander des corticoïdes pour réduire l'inflammation dans les poumons."],
62
+ ["Pour soulager les symptômes d'allergie, le médecin prescrit des antihistaminiques."],
63
+ ["Si le patient souffre de diabète de type 2, le médecin peut prescrire une insulinothérapie par exemple: Metformine 500mg."],
64
+ ["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."],
65
+ ["En cas d'infection bactérienne, le médecin recommande une antibiothérapie."],
66
+ ["Antécédents: infarctus du myocarde en 2019. Allergie à la pénicilline."]
67
+ ]
68
+ )
 
 
 
 
 
 
 
 
 
69
 
70
 
71
  # Add marketing elements