Skip to content

Latest commit

 

History

History
216 lines (162 loc) · 7.61 KB

File metadata and controls

216 lines (162 loc) · 7.61 KB

🔒 GemmaSOS Demo Guide - Testing On-Device Crisis Response

Overview

The GemmaSOS Demo is an interactive testing environment that showcases how Google's Gemma lightweight model can detect crisis situations and generate empathetic responses entirely on your device. This demo allows you to test the system's capabilities without requiring the full installation.

🚀 Quick Start

Running the Demo

  1. Start the demo application:

    python demo_app.py
  2. Open your browser: Navigate to http://localhost:7861

  3. Load the Gemma model: Click "Load Gemma Model" to initialize the system

  4. Test crisis detection: Use the demo scenarios or enter your own text

🧪 Demo Features

1. Model Loading Simulation

  • Purpose: Demonstrates on-device model initialization
  • What it shows: How the Gemma model loads locally without external dependencies
  • Privacy: Simulates the actual loading process while maintaining privacy

2. Crisis Detection Testing

  • Text Analysis: Enter custom text or load predefined scenarios
  • Keyword Detection: Identifies crisis-related terms and phrases
  • Confidence Scoring: Shows how confident the system is in its detection

3. Gemma Model Analysis

  • AI-Powered Assessment: Simulates how Gemma analyzes crisis situations
  • Risk Level Determination: Categorizes risk as low, medium, or high
  • Immediate Risk Detection: Identifies situations requiring urgent intervention

4. Response Generation

  • Empathetic Responses: Generates supportive, trauma-informed responses
  • Resource Matching: Provides relevant crisis resources and helplines
  • Safety Planning: Includes immediate safety recommendations when needed

📚 Demo Scenarios

Crisis Scenarios (High Risk)

  1. Self-Harm Crisis: "I want to cut myself tonight. I can't take this pain anymore."
  2. Suicidal Ideation: "I don't want to live anymore. Everyone would be better off without me."
  3. Violence Threat: "I'm going to hurt someone who deserves it. They'll pay for what they did."
  4. Abuse Situation: "He hits me every day and I'm scared. I don't know what to do."
  5. Overdose Situation: "I took too many pills and I feel really sick. I think I need help."

Subtle Crisis Scenarios (Medium Risk)

  1. Subtle Self-Harm: "I've been scratching myself when I'm stressed. It helps me feel something."
  2. Passive Suicidal Thoughts: "Sometimes I wish I could just disappear. Life feels so heavy."
  3. Emotional Abuse: "My partner constantly puts me down and makes me feel worthless."
  4. Drug Use Concern: "I've been taking more pills than prescribed. I know it's not good but I need them to cope."

Non-Crisis Scenarios (No Risk)

  1. Work Stress: "Work has been really stressful lately. I'm overwhelmed with deadlines."
  2. Relationship Problems: "My partner and I have been fighting a lot. I don't know if we can work this out."
  3. General Sadness: "I'm feeling really sad today. Nothing seems to be going right."

🔍 Testing the System

Step-by-Step Testing Process

  1. Load a Demo Scenario

    • Select a scenario from the dropdown
    • Click "Load Scenario" to populate the text field
    • Observe the pre-written crisis situation
  2. Analyze the Text

    • Click "Analyze for Crisis" to run the detection
    • Review the crisis detection results
    • Check the Gemma model analysis
  3. Review the Response

    • Read the generated empathetic response
    • Note the provided resources and helplines
    • Observe the safety recommendations
  4. Test Custom Text

    • Clear the text field
    • Enter your own test message
    • Repeat the analysis process

What to Look For

Crisis Detection Results

  • Crisis Detected: True/False
  • Categories: List of detected crisis types
  • Confidence: How confident the system is (0.0-1.0)
  • Matched Keywords: Specific terms that triggered detection

Gemma Model Analysis

  • Crisis Level: none, low, medium, high
  • Immediate Risk: True/False
  • Analysis: AI-generated assessment of the situation
  • Confidence: Model's confidence in the analysis

Generated Response

  • Empathetic Tone: Supportive, non-judgmental language
  • Resource Matching: Relevant crisis resources and helplines
  • Safety Planning: Immediate actions for high-risk situations
  • Appropriate Urgency: Response matches the detected risk level

🎯 Testing Scenarios

Accuracy Testing

Test the system's ability to correctly identify crisis situations:

High Accuracy Expected:

  • Clear crisis indicators (scenarios 2-6)
  • Obvious non-crisis situations (scenarios 1, 11-12)

Medium Accuracy Expected:

  • Subtle crisis indicators (scenarios 7-10)
  • Ambiguous situations

Response Quality Testing

Evaluate the quality of generated responses:

Check for:

  • Empathetic and supportive tone
  • Appropriate resource recommendations
  • Safety planning for high-risk situations
  • Non-judgmental language

Privacy Testing

Verify on-device processing:

Confirm:

  • No data is sent to external servers
  • All processing happens locally
  • No permanent storage of user input
  • Complete privacy protection

🔧 Demo Configuration

Model Settings

  • Model: Google Gemma-2B (simulated)
  • Device: CPU/GPU detection
  • Processing: On-device only
  • Privacy: Complete local processing

Detection Thresholds

  • Immediate Risk: 0.8+ confidence
  • High Risk: 0.6+ confidence
  • Medium Risk: 0.4+ confidence
  • Low Risk: 0.2+ confidence

Response Generation

  • Templates: Pre-defined empathetic responses
  • Resource Matching: Crisis-specific helplines
  • Safety Planning: Immediate action recommendations

🚨 Important Notes

Demo Limitations

  • Simulated Model: This demo simulates Gemma model behavior
  • Simplified Detection: Uses keyword matching for demonstration
  • Pre-defined Responses: Responses are template-based
  • No Real AI: Actual Gemma model not loaded in demo

Real System Differences

  • Actual Gemma Model: Full system loads real Gemma-2B model
  • Advanced Detection: Uses actual AI for crisis detection
  • Dynamic Responses: Generates unique responses using AI
  • Full Privacy: Complete on-device processing

Safety Considerations

  • Demo Only: This is for testing and demonstration purposes
  • Not a Replacement: Not a substitute for professional mental health care
  • Emergency Situations: Always call 911 or 988 for real crises
  • Professional Help: Seek professional mental health support when needed

📊 Expected Results

Crisis Detection Accuracy

  • Clear Crisis: 90%+ accuracy
  • Non-Crisis: 95%+ accuracy
  • Subtle Crisis: 80%+ accuracy

Response Quality

  • Empathetic Tone: Supportive, non-judgmental
  • Resource Relevance: Appropriate crisis resources
  • Safety Planning: Clear action steps for high-risk situations

Privacy Protection

  • On-Device Processing: 100% local processing
  • No Data Transmission: Zero external communication
  • Temporary Storage: No permanent data retention

🆘 Emergency Resources

If you or someone you know is in immediate danger:

  • Call 911 for emergency services
  • Call 988 for Suicide & Crisis Lifeline
  • Text HOME to 741741 for Crisis Text Line
  • Go to your nearest emergency room

📞 Support

For technical support or questions about the demo:

  • Check the main README.md file
  • Review the system documentation
  • Contact the development team

Remember: This demo is for testing and demonstration purposes only. It is not a replacement for professional mental health care or emergency services.