Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,58 +35,58 @@ def log_demo_usage(text, num_entities):
|
|
| 35 |
|
| 36 |
|
| 37 |
# Define the main demo interface
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
with gr.Row():
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 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 | As featured in 'NLP on OCI'",
|
| 50 |
-
description="""
|
| 51 |
-
🔬 Live demo of the French Healthcare NER model built in Chapter 6 of the book 'Natural Language Processing on Oracle Cloud Infrastructure: Building Transformer-Based NLP Solutions Using Oracle AI and Hugging Face Kindle Edition'
|
| 52 |
-
|
| 53 |
-
📚 Follow along with the book to build this exact model step-by-step
|
| 54 |
-
🏥 Perfect for medical text analysis, clinical studies, and healthcare compliance
|
| 55 |
-
⚡ Model Trained on Oracle Cloud Infrastructure (OCI)
|
| 56 |
-
|
| 57 |
-
By [Hicham Assoudi] - AI Researcher (Ph.D.) • Oracle Consultant • Author
|
| 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 |
-
# Add marketing elements
|
| 71 |
-
#with gr.Blocks() as marketing_elements:
|
| 72 |
-
gr.Markdown("""
|
| 73 |
-
### 📖 Get the Complete Guide
|
| 74 |
-
|
| 75 |
-
Learn how to build and deploy this exact model in 'Natural Language Processing on Oracle Cloud Infrastructure: Building Transformer-Based NLP Solutions Using Oracle AI and Hugging Face Kindle Edition'
|
| 76 |
-
- ✓ Step-by-step implementation
|
| 77 |
-
- ✓ Performance optimization
|
| 78 |
-
- ✓ Enterprise deployment patterns
|
| 79 |
-
- ✓ Complete source code
|
| 80 |
-
|
| 81 |
-
[Get the Book](https://a.co/d/eg7my5G)
|
| 82 |
-
""")
|
| 83 |
-
|
| 84 |
-
with gr.Row():
|
| 85 |
-
email_input = gr.Textbox(
|
| 86 |
-
label="Get the French Healthcare NER Dataset",
|
| 87 |
-
placeholder="Enter your business email"
|
| 88 |
-
)
|
| 89 |
-
submit_btn = gr.Button("Access Dataset")
|
| 90 |
|
| 91 |
# Launch the Gradio demo
|
| 92 |
if __name__ == "__main__":
|
|
|
|
| 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 | As featured in 'NLP on OCI'",
|
| 50 |
+
description="""
|
| 51 |
+
🔬 Live demo of the French Healthcare NER model built in Chapter 6 of the book 'Natural Language Processing on Oracle Cloud Infrastructure: Building Transformer-Based NLP Solutions Using Oracle AI and Hugging Face Kindle Edition'
|
| 52 |
+
|
| 53 |
+
📚 Follow along with the book to build this exact model step-by-step
|
| 54 |
+
🏥 Perfect for medical text analysis, clinical studies, and healthcare compliance
|
| 55 |
+
⚡ Model Trained on Oracle Cloud Infrastructure (OCI)
|
| 56 |
+
|
| 57 |
+
By [Hicham Assoudi] - AI Researcher (Ph.D.) • Oracle Consultant • Author
|
| 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 |
+
# Add marketing elements
|
| 71 |
+
with gr.Blocks() as marketing_elements:
|
| 72 |
+
gr.Markdown("""
|
| 73 |
+
### 📖 Get the Complete Guide
|
| 74 |
+
|
| 75 |
+
Learn how to build and deploy this exact model in 'Natural Language Processing on Oracle Cloud Infrastructure: Building Transformer-Based NLP Solutions Using Oracle AI and Hugging Face Kindle Edition'
|
| 76 |
+
- ✓ Step-by-step implementation
|
| 77 |
+
- ✓ Performance optimization
|
| 78 |
+
- ✓ Enterprise deployment patterns
|
| 79 |
+
- ✓ Complete source code
|
| 80 |
+
|
| 81 |
+
[Get the Book](https://a.co/d/eg7my5G)
|
| 82 |
+
""")
|
| 83 |
+
|
| 84 |
with gr.Row():
|
| 85 |
+
email_input = gr.Textbox(
|
| 86 |
+
label="Get the French Healthcare NER Dataset",
|
| 87 |
+
placeholder="Enter your business email"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
)
|
| 89 |
+
submit_btn = gr.Button("Access Dataset")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
# Launch the Gradio demo
|
| 92 |
if __name__ == "__main__":
|