Spaces:
Sleeping
Sleeping
Revise user guide and quick start instructions for clarity and accessibility in the simplified Gradio interface
Browse files476 unmodified lines477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593476 unmodified lines# Instructions tabwith gr.TabItem("📖 Help", id="help"):gr.Markdown("""## 📚 Medical Assistant with Spiritual Support### 🎯 OverviewThis is a unified medical assistant with integrated spiritual health monitoring. The system automatically detects emotional and spiritual distress while you discuss medical concerns.### 💬 Chat Tab**Main Interface** - Ask medical questions and receive health guidance:- Medical symptoms and concerns- Medication questions- Health management advice- Wellness supportThe system monitors for emotional/spiritual distress in the background and provides support when needed.### ⚙️ Model Settings Tab**Configure AI Models** - Choose which AI models to use for different tasks:- 🔍 Spiritual Monitor (Classifier) - Detects spiritual distress- 🟡 Soft Spiritual Triage - Asks clarifying questions- 📊 Triage Response Evaluator - Assesses responses- 🏥 Medical Assistant - Provides medical guidance- 🩺 Soft Medical Triage - Gentle health check-ins**Available Models:**- Claude (Anthropic) - Best for empathy and nuanced understanding- Gemini (Google) - Fast and efficient for classification### 👥 Patient Profiles Tab**Test Different Scenarios** - Load predefined patient profiles:**Testing Spiritual Functionality:**- 🟢 GREEN - Healthy: No distress indicators- 🟡 YELLOW - Mild Distress: Stress, anxiety, sleep issues- 🟡 YELLOW - Grief & Loss: Processing loss- 🟡 YELLOW - Existential Questions: Life meaning concerns- 🟡 YELLOW - Spiritual Disconnection: Loss of faith- 🔴 RED - Crisis (Suicidal): Immediate intervention needed- 🔴 RED - Severe Hopelessness: Complete despair- 🔴 RED - Spiritual Crisis: Moral injury, anger at God**Medical Profiles:**- Cardiac Patient, Diabetic Patient, Post-Surgery Recovery- Mental Health Focus, Elderly Patient, Athletic Patient### 🔧 Edit Prompts Tab**Customize System Prompts** - Modify AI behavior for your session:- 🔍 Spiritual Monitor (Classifier)- 🟡 Soft Spiritual Triage- 📊 Triage Response Evaluator- 🏥 Medical Assistant- 🩺 Soft Medical TriageChanges apply only to your current session.### 🟢 GREEN State**No Distress Detected** - Normal medical conversation- Medical symptoms only- Routine health questions- Standard healthcare topics### 🟡 YELLOW State**Potential Distress Detected** - Gentle triage begins- Emotional or spiritual concerns detected- System asks 2-3 clarifying questions- Assesses if patient needs referral**Indicators:**- Stress, anxiety, worry- Grief or loss- Existential questions- Loneliness or isolation- Feeling overwhelmed### 🔴 RED State**Severe Distress - Immediate Referral**- Crisis language detected- Suicidal ideation- Severe hopelessness- Spiritual crisis**Immediate Actions:**- Referral generated- Spiritual care team notified- Crisis resources provided### 💭 Spiritual Distress Examples**YELLOW Indicators:**- "I'm feeling stressed and overwhelmed"- "I've lost my faith lately"- "I feel so alone since my spouse passed"- "What's the point of all this suffering?"- "I can't sleep, I'm so anxious"**RED Indicators:**- "I want to end it all"- "I can't go on anymore"- "I'm so angry at God"- "Nobody would miss me"- "I have no reason to live"### ⚠️ Important- This is NOT a replacement for professional medical care- For emergencies, call emergency services immediately- Crisis support is available 24/7- All conversations are confidential### 🔐 Privacy & Security- Session data is stored locally- No data is shared externally- Each session is independent- Clear chat to remove history""")# Event handlers476 unmodified lines477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586476 unmodified lines# Instructions tabwith gr.TabItem("📖 Help", id="help"):gr.Markdown("""## 📖 User Guide (Non‑Technical)### What this app isThis is a **Medical Assistant** that also watches for **emotional / spiritual distress** in the background.You can chat naturally about health and lifestyle. If the system detects distress, it gently adapts the conversation.---## 🚀 Quick Start### Quick Start: Chat (everyday use)1. Open the **Chat** tab.2. Type your question (symptoms, medications, lifestyle, recovery, etc.).3. Read the response.4. If the system detects distress, it may ask a few gentle follow‑up questions.### Quick Start: Testing / QA (Enhanced Verification)1. Open **Enhanced Verification**.2. Choose one mode:- **Manual Input** (test one message)- **File Upload** (test many messages in a batch)3. Run classification.4. Export results as **CSV** or **JSON**.---## 💬 Chat: What to expectUse Chat for:- health questions and symptoms- medication questions- recovery and rehab guidance- lifestyle support (activity, nutrition, habits)The system continuously monitors messages for possible distress while you chat.---## 🧭 Distress levels (how the system reacts)You may see one of these behaviors during a conversation:### 🟢 GREEN — No distress detectedNormal medical conversation.### 🟡 YELLOW — Possible distressThe assistant may ask **2–3 short, gentle questions** to clarify what you’re going through.Goal: understand whether extra support (like a referral) may be helpful.### 🔴 RED — Severe distress / safety concernThe assistant prioritizes safety and guidance.It may generate referral‑style guidance and suggest urgent help.---## ⚙️ Model Settings (AI Model Configuration)You can choose which AI model is used for different tasks (e.g., monitoring vs. medical advice).**Session‑only:** Model changes apply only to your **current session**.Starting a new session resets to defaults.---## 🔧 Edit Prompts (Customize behavior)Prompts control *how* the AI behaves (tone, structure, rules).**Session‑only:** Prompt edits apply only to your **current session**.They do not affect other sessions.Tip: after you click **Apply Changes**, the next message or batch run will use the updated prompt.---## ✅ Enhanced Verification (Testing modes)Enhanced Verification is a testing/validation environment. It helps you measure quality and export results.### ✏️ Manual Input ModeUse this when you want to test a single message quickly:1. Enter a message.2. Run classification.3. Review results and save the verification.### 📁 File Upload ModeUse this when you want to test an entire dataset:1. Download the CSV template (in the UI).2. Fill in your test messages.3. Upload the CSV.4. Start **batch classification** (one click).5. Review totals and accuracy.---## 💾 ExportsExports are available in Enhanced Verification:- **CSV**- **JSON**CSV note:- The **Notes** column contains **only the model `reasoning`** (when present).---## 🔐 Privacy & Safety- Session data is stored locally.- This tool does not replace professional medical advice.- If there is an emergency, contact local emergency services.""")# Event handlers
src/interface/simplified_gradio_app.py+104-111