hassoudi commited on
Commit
4c42d5a
·
verified ·
1 Parent(s): 1dfdcdd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -47
app.py CHANGED
@@ -28,57 +28,65 @@ def log_demo_usage(text, num_entities):
28
  """Log demo usage for analytics."""
29
  print(f"Processed text: {text[:50]}... | Entities found: {num_entities}")
30
 
 
 
 
31
  # Define the Gradio interface
32
- demo = gr.Interface(
33
- fn=process_text,
34
- inputs=gr.Textbox(
35
- label="Paste French medical text",
36
- placeholder="Le patient présente une hypertension artérielle...",
37
- lines=5
38
- ),
39
- outputs=gr.HighlightedText(),
40
- #outputs=gr.HTML(label="Identified Medical Entities"),
41
- title="French Healthcare NER Demo | As featured in 'NLP on OCI'",
42
- description="""
43
- 🔬 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'
44
-
45
- 📚 Follow along with the book to build this exact model step-by-step
46
- 🏥 Perfect for medical text analysis, clinical studies, and healthcare compliance
47
- ⚡ Model Trained on Oracle Cloud Infrastructure (OCI)
48
-
49
- By [Hicham Assoudi] - AI Researcher (Ph.D.) • Oracle Consultant • Author
50
- """,
51
- examples=[
52
- ["Le medecin donne des antibiotiques en cas d'infections des voies respiratoires e.g. pneumonie."],
53
- ["Dans le cas de l'asthme, le médecin peut recommander des corticoïdes pour réduire l'inflammation dans les poumons."],
54
- ["Pour soulager les symptômes d'allergie, le médecin prescrit des antihistaminiques."],
55
- ["Si le patient souffre de diabète de type 2, le médecin peut prescrire une insulinothérapie par exemple: Metformine 500mg."],
56
- ["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."],
57
- ["En cas d'infection bactérienne, le médecin recommande une antibiothérapie."],
58
- ["Antécédents: infarctus du myocarde en 2019. Allergie à la pénicilline."]
59
- ]
60
- )
61
 
62
- # Add marketing elements
63
- with gr.Blocks() as marketing_elements:
64
- gr.Markdown("""
65
- ### 📖 Get the Complete Guide
66
-
67
- 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'
68
- - ✓ Step-by-step implementation
69
- - ✓ Performance optimization
70
- - ✓ Enterprise deployment patterns
71
- - ✓ Complete source code
72
-
73
- [Get the Book](https://a.co/d/eg7my5G)
74
- """)
75
-
76
  with gr.Row():
77
- email_input = gr.Textbox(
78
- label="Get the French Healthcare NER Dataset",
79
- placeholder="Enter your business email"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  )
81
- submit_btn = gr.Button("Access Dataset")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
  # Launch the Gradio demo
84
  if __name__ == "__main__":
 
28
  """Log demo usage for analytics."""
29
  print(f"Processed text: {text[:50]}... | Entities found: {num_entities}")
30
 
31
+
32
+
33
+
34
  # Define the Gradio interface
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
+
37
+ # Define the main demo interface
38
+ with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
39
  with gr.Row():
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__":