imogie commited on
Commit
7ff0052
Β·
verified Β·
1 Parent(s): b0b6579

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -581,35 +581,35 @@ class PediatricPulmonologyChatbot:
581
  return f"I identified this might be related to **{condition.replace('_', ' ').title()}** (confidence: {confidence:.2f}), but I need more information to provide specific guidance. Please consult a pediatric pulmonologist."
582
 
583
  # Build comprehensive response with confidence indicator
584
- confidence_indicator = "🟒 High" if confidence > 0.6 else "🟑 Moderate" if confidence > 0.3 else "🟠 Low"
585
 
586
- response = f"## 🩺 **Analysis Result**\n\n"
587
  response += f"**Possible Condition:** {condition.replace('_', ' ').title()}\n"
588
  response += f"**Confidence Level:** {confidence_indicator} ({confidence:.2f})\n\n"
589
 
590
- response += f"**πŸ“‹ Definition:**\n{info['definition']}\n\n"
591
 
592
  if info['symptoms']:
593
- response += "**πŸ” Common Symptoms:**\n"
594
  for symptom in info['symptoms'][:4]:
595
  response += f"β€’ {symptom}\n"
596
  response += "\n"
597
 
598
  if info['red_flags']:
599
- response += "**🚨 RED FLAGS - Seek URGENT Medical Care if you notice:**\n"
600
  for flag in info['red_flags']:
601
- response += f"β€’ ⚠️ {flag}\n"
602
  response += "\n"
603
 
604
  if info['advice']:
605
- response += f"**πŸ’‘ General Advice:**\n{info['advice']}\n\n"
606
 
607
  # Add confidence-based disclaimer
608
  if confidence < 0.4:
609
- response += "**⚠️ Low Confidence Notice:**\nThis prediction has lower confidence. Please provide more specific symptoms or consult a healthcare provider for accurate assessment.\n\n"
610
 
611
  response += """---
612
- **⚠️ IMPORTANT DISCLAIMER:**
613
  - This is for educational purposes only
614
  - Always consult a pediatrician for proper diagnosis
615
  - If symptoms worsen or red flags appear, seek immediate medical attention
@@ -670,7 +670,7 @@ with gr.Blocks(
670
  # Warning Box
671
  gr.HTML("""
672
  <div class="warning-box">
673
- <h3>⚠️ Medical Disclaimer</h3>
674
  <p><strong>This tool is for educational purposes only and is not a substitute for professional medical advice.</strong>
675
  Always consult with a qualified pediatrician or healthcare provider for proper diagnosis and treatment.
676
  In case of emergency or severe symptoms, call emergency services immediately.</p>
@@ -692,14 +692,14 @@ with gr.Blocks(
692
  scale=4,
693
  lines=2
694
  )
695
- send_btn = gr.Button("Send πŸ“€", scale=1, variant="primary")
696
 
697
  with gr.Row():
698
- clear_btn = gr.Button("Clear Chat πŸ—‘οΈ", variant="secondary")
699
 
700
  # Quick Examples
701
  gr.Markdown("""
702
- ### πŸ’‘ Example Questions You Can Ask:
703
 
704
  - "My 2-year-old has been wheezing and coughing, especially at night"
705
  - "Baby has runny nose, fast breathing, and won't eat well"
@@ -709,7 +709,7 @@ with gr.Blocks(
709
  """)
710
 
711
  # Conditions Covered
712
- with gr.Accordion("πŸ” Conditions This Assistant Can Help With", open=False):
713
  gr.Markdown("""
714
  **Common Conditions:**
715
  - Asthma
 
581
  return f"I identified this might be related to **{condition.replace('_', ' ').title()}** (confidence: {confidence:.2f}), but I need more information to provide specific guidance. Please consult a pediatric pulmonologist."
582
 
583
  # Build comprehensive response with confidence indicator
584
+ confidence_indicator = "High" if confidence > 0.6 else "Moderate" if confidence > 0.3 else "Low"
585
 
586
+ response = f"## **Analysis Result**\n\n"
587
  response += f"**Possible Condition:** {condition.replace('_', ' ').title()}\n"
588
  response += f"**Confidence Level:** {confidence_indicator} ({confidence:.2f})\n\n"
589
 
590
+ response += f"**Definition:**\n{info['definition']}\n\n"
591
 
592
  if info['symptoms']:
593
+ response += "**Common Symptoms:**\n"
594
  for symptom in info['symptoms'][:4]:
595
  response += f"β€’ {symptom}\n"
596
  response += "\n"
597
 
598
  if info['red_flags']:
599
+ response += "**RED FLAGS - Seek URGENT Medical Care if you notice:**\n"
600
  for flag in info['red_flags']:
601
+ response += f"β€’{flag}\n"
602
  response += "\n"
603
 
604
  if info['advice']:
605
+ response += f"**General Advice:**\n{info['advice']}\n\n"
606
 
607
  # Add confidence-based disclaimer
608
  if confidence < 0.4:
609
+ response += "**Low Confidence Notice:**\nThis prediction has lower confidence. Please provide more specific symptoms or consult a healthcare provider for accurate assessment.\n\n"
610
 
611
  response += """---
612
+ **IMPORTANT DISCLAIMER:**
613
  - This is for educational purposes only
614
  - Always consult a pediatrician for proper diagnosis
615
  - If symptoms worsen or red flags appear, seek immediate medical attention
 
670
  # Warning Box
671
  gr.HTML("""
672
  <div class="warning-box">
673
+ <h3> Medical Disclaimer</h3>
674
  <p><strong>This tool is for educational purposes only and is not a substitute for professional medical advice.</strong>
675
  Always consult with a qualified pediatrician or healthcare provider for proper diagnosis and treatment.
676
  In case of emergency or severe symptoms, call emergency services immediately.</p>
 
692
  scale=4,
693
  lines=2
694
  )
695
+ send_btn = gr.Button("Send", scale=1, variant="primary")
696
 
697
  with gr.Row():
698
+ clear_btn = gr.Button("Clear Chat", variant="secondary")
699
 
700
  # Quick Examples
701
  gr.Markdown("""
702
+ ###Example Questions You Can Ask:
703
 
704
  - "My 2-year-old has been wheezing and coughing, especially at night"
705
  - "Baby has runny nose, fast breathing, and won't eat well"
 
709
  """)
710
 
711
  # Conditions Covered
712
+ with gr.Accordion("Conditions This Assistant Can Help With", open=False):
713
  gr.Markdown("""
714
  **Common Conditions:**
715
  - Asthma