Spaces:
Sleeping
Sleeping
File size: 2,132 Bytes
a350303 f33c0ca a350303 f33c0ca a350303 9d5574c f33c0ca 9d5574c f33c0ca 9d5574c f33c0ca 9d5574c f33c0ca 9d5574c f33c0ca 9d5574c f33c0ca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
import gradio as gr
from huggingface_hub import login
import os
def load_healthcare_ner():
login(token=os.environ["HF_TOKEN"])
model = AutoModelForTokenClassification.from_pretrained(
"TypicaAI/HealthcareNER-Fr",
token=os.environ["HF_TOKEN"]
)
return model
def process_text(text):
entities = model(text)
# Format results with highlighting
html_output = highlight_entities(text, entities)
# Track usage for marketing insights
log_demo_usage(text, len(entities))
return html_output
demo = gr.Interface(
fn=process_text,
inputs=gr.Textbox(
label="Paste French medical text",
placeholder="Le patient présente une hypertension artérielle...",
lines=5
),
outputs=gr.HTML(label="Identified Medical Entities"),
title="French Healthcare NER Demo | As featured in 'NLP on OCI'",
description="""
🔬 Live demo of the French Healthcare NER model built in Chapter 5 of 'NLP on OCI'
📚 Follow along with the book to build this exact model step-by-step
🏥 Perfect for medical text analysis, clinical studies, and healthcare compliance
⚡ Powered by Oracle Cloud Infrastructure
By [Hicham Assoudi] - Oracle Consultant & AI Researcher
""",
examples=[
["Le patient souffre d'hypertension et diabète de type 2. Traitement: Metformine 500mg."],
["Antécédents: infarctus du myocarde en 2019. Allergie à la pénicilline."]
]
)
# Add conversion elements
with gr.Blocks() as marketing_elements:
gr.Markdown("""
### 📖 Get the Complete Guide
Learn how to build and deploy this exact model in 'NLP on OCI'
- ✓ Step-by-step implementation
- ✓ Performance optimization
- ✓ Enterprise deployment patterns
- ✓ Complete source code
[Get the Book](your-book-link) | Use code `NERSPACE` for 15% off
""")
with gr.Row():
email_input = gr.Textbox(
label="Get the French Healthcare NER Dataset",
placeholder="Enter your business email"
)
submit_btn = gr.Button("Access Dataset") |