DocUA commited on
Commit
118fcee
·
1 Parent(s): 2e0e95f

Revise user guide and quick start instructions for clarity and accessibility in the simplified Gradio interface

Browse files
Files changed (1) hide show
  1. src/interface/simplified_gradio_app.py +104 -111
src/interface/simplified_gradio_app.py CHANGED
@@ -477,117 +477,110 @@ def create_simplified_interface():
477
  # Instructions tab
478
  with gr.TabItem("📖 Help", id="help"):
479
  gr.Markdown("""
480
- ## 📚 Medical Assistant with Spiritual Support
481
-
482
- ### 🎯 Overview
483
- This is a unified medical assistant with integrated spiritual health monitoring. The system automatically detects emotional and spiritual distress while you discuss medical concerns.
484
-
485
- ### 💬 Chat Tab
486
- **Main Interface** - Ask medical questions and receive health guidance:
487
- - Medical symptoms and concerns
488
- - Medication questions
489
- - Health management advice
490
- - Wellness support
491
-
492
- The system monitors for emotional/spiritual distress in the background and provides support when needed.
493
-
494
- ### ⚙️ Model Settings Tab
495
- **Configure AI Models** - Choose which AI models to use for different tasks:
496
- - 🔍 Spiritual Monitor (Classifier) - Detects spiritual distress
497
- - 🟡 Soft Spiritual Triage - Asks clarifying questions
498
- - 📊 Triage Response Evaluator - Assesses responses
499
- - 🏥 Medical Assistant - Provides medical guidance
500
- - 🩺 Soft Medical Triage - Gentle health check-ins
501
-
502
- **Available Models:**
503
- - Claude (Anthropic) - Best for empathy and nuanced understanding
504
- - Gemini (Google) - Fast and efficient for classification
505
-
506
- ### 👥 Patient Profiles Tab
507
- **Test Different Scenarios** - Load predefined patient profiles:
508
-
509
- **Testing Spiritual Functionality:**
510
- - 🟢 GREEN - Healthy: No distress indicators
511
- - 🟡 YELLOW - Mild Distress: Stress, anxiety, sleep issues
512
- - 🟡 YELLOW - Grief & Loss: Processing loss
513
- - 🟡 YELLOW - Existential Questions: Life meaning concerns
514
- - 🟡 YELLOW - Spiritual Disconnection: Loss of faith
515
- - 🔴 RED - Crisis (Suicidal): Immediate intervention needed
516
- - 🔴 RED - Severe Hopelessness: Complete despair
517
- - 🔴 RED - Spiritual Crisis: Moral injury, anger at God
518
-
519
- **Medical Profiles:**
520
- - Cardiac Patient, Diabetic Patient, Post-Surgery Recovery
521
- - Mental Health Focus, Elderly Patient, Athletic Patient
522
-
523
- ### 🔧 Edit Prompts Tab
524
- **Customize System Prompts** - Modify AI behavior for your session:
525
- - 🔍 Spiritual Monitor (Classifier)
526
- - 🟡 Soft Spiritual Triage
527
- - 📊 Triage Response Evaluator
528
- - 🏥 Medical Assistant
529
- - 🩺 Soft Medical Triage
530
-
531
- Changes apply only to your current session.
532
-
533
- ### 🟢 GREEN State
534
- **No Distress Detected** - Normal medical conversation
535
- - Medical symptoms only
536
- - Routine health questions
537
- - Standard healthcare topics
538
-
539
- ### 🟡 YELLOW State
540
- **Potential Distress Detected** - Gentle triage begins
541
- - Emotional or spiritual concerns detected
542
- - System asks 2-3 clarifying questions
543
- - Assesses if patient needs referral
544
-
545
- **Indicators:**
546
- - Stress, anxiety, worry
547
- - Grief or loss
548
- - Existential questions
549
- - Loneliness or isolation
550
- - Feeling overwhelmed
551
-
552
- ### 🔴 RED State
553
- **Severe Distress - Immediate Referral**
554
- - Crisis language detected
555
- - Suicidal ideation
556
- - Severe hopelessness
557
- - Spiritual crisis
558
-
559
- **Immediate Actions:**
560
- - Referral generated
561
- - Spiritual care team notified
562
- - Crisis resources provided
563
-
564
- ### 💭 Spiritual Distress Examples
565
-
566
- **YELLOW Indicators:**
567
- - "I'm feeling stressed and overwhelmed"
568
- - "I've lost my faith lately"
569
- - "I feel so alone since my spouse passed"
570
- - "What's the point of all this suffering?"
571
- - "I can't sleep, I'm so anxious"
572
-
573
- **RED Indicators:**
574
- - "I want to end it all"
575
- - "I can't go on anymore"
576
- - "I'm so angry at God"
577
- - "Nobody would miss me"
578
- - "I have no reason to live"
579
-
580
- ### ⚠️ Important
581
- - This is NOT a replacement for professional medical care
582
- - For emergencies, call emergency services immediately
583
- - Crisis support is available 24/7
584
- - All conversations are confidential
585
-
586
- ### 🔐 Privacy & Security
587
- - Session data is stored locally
588
- - No data is shared externally
589
- - Each session is independent
590
- - Clear chat to remove history
591
  """)
592
 
593
  # Event handlers
 
477
  # Instructions tab
478
  with gr.TabItem("📖 Help", id="help"):
479
  gr.Markdown("""
480
+ ## 📖 User Guide (Non‑Technical)
481
+
482
+ ### What this app is
483
+ This is a **Medical Assistant** that also watches for **emotional / spiritual distress** in the background.
484
+ You can chat naturally about health and lifestyle. If the system detects distress, it gently adapts the conversation.
485
+
486
+ ---
487
+
488
+ ## 🚀 Quick Start
489
+
490
+ ### Quick Start: Chat (everyday use)
491
+ 1. Open the **Chat** tab.
492
+ 2. Type your question (symptoms, medications, lifestyle, recovery, etc.).
493
+ 3. Read the response.
494
+ 4. If the system detects distress, it may ask a few gentle follow‑up questions.
495
+
496
+ ### Quick Start: Testing / QA (Enhanced Verification)
497
+ 1. Open **Enhanced Verification**.
498
+ 2. Choose one mode:
499
+ - **Manual Input** (test one message)
500
+ - **File Upload** (test many messages in a batch)
501
+ 3. Run classification.
502
+ 4. Export results as **CSV** or **JSON**.
503
+
504
+ ---
505
+
506
+ ## 💬 Chat: What to expect
507
+ Use Chat for:
508
+ - health questions and symptoms
509
+ - medication questions
510
+ - recovery and rehab guidance
511
+ - lifestyle support (activity, nutrition, habits)
512
+
513
+ The system continuously monitors messages for possible distress while you chat.
514
+
515
+ ---
516
+
517
+ ## 🧭 Distress levels (how the system reacts)
518
+ You may see one of these behaviors during a conversation:
519
+
520
+ ### 🟢 GREEN No distress detected
521
+ Normal medical conversation.
522
+
523
+ ### 🟡 YELLOW Possible distress
524
+ The assistant may ask **2–3 short, gentle questions** to clarify what you’re going through.
525
+ Goal: understand whether extra support (like a referral) may be helpful.
526
+
527
+ ### 🔴 RED Severe distress / safety concern
528
+ The assistant prioritizes safety and guidance.
529
+ It may generate referral‑style guidance and suggest urgent help.
530
+
531
+ ---
532
+
533
+ ## ⚙️ Model Settings (AI Model Configuration)
534
+ You can choose which AI model is used for different tasks (e.g., monitoring vs. medical advice).
535
+
536
+ **Session‑only:** Model changes apply only to your **current session**.
537
+ Starting a new session resets to defaults.
538
+
539
+ ---
540
+
541
+ ## 🔧 Edit Prompts (Customize behavior)
542
+ Prompts control *how* the AI behaves (tone, structure, rules).
543
+
544
+ **Session‑only:** Prompt edits apply only to your **current session**.
545
+ They do not affect other sessions.
546
+
547
+ Tip: after you click **Apply Changes**, the next message or batch run will use the updated prompt.
548
+
549
+ ---
550
+
551
+ ## ✅ Enhanced Verification (Testing modes)
552
+ Enhanced Verification is a testing/validation environment. It helps you measure quality and export results.
553
+
554
+ ### ✏️ Manual Input Mode
555
+ Use this when you want to test a single message quickly:
556
+ 1. Enter a message.
557
+ 2. Run classification.
558
+ 3. Review results and save the verification.
559
+
560
+ ### 📁 File Upload Mode
561
+ Use this when you want to test an entire dataset:
562
+ 1. Download the CSV template (in the UI).
563
+ 2. Fill in your test messages.
564
+ 3. Upload the CSV.
565
+ 4. Start **batch classification** (one click).
566
+ 5. Review totals and accuracy.
567
+
568
+ ---
569
+
570
+ ## 💾 Exports
571
+ Exports are available in Enhanced Verification:
572
+ - **CSV**
573
+ - **JSON**
574
+
575
+ CSV note:
576
+ - The **Notes** column contains **only the model `reasoning`** (when present).
577
+
578
+ ---
579
+
580
+ ## 🔐 Privacy & Safety
581
+ - Session data is stored locally.
582
+ - This tool does not replace professional medical advice.
583
+ - If there is an emergency, contact local emergency services.
 
 
 
 
 
 
 
584
  """)
585
 
586
  # Event handlers