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.
-
Start the demo application:
python demo_app.py
-
Open your browser: Navigate to
http://localhost:7861 -
Load the Gemma model: Click "Load Gemma Model" to initialize the system
-
Test crisis detection: Use the demo scenarios or enter your own text
- 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
- 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
- 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
- Empathetic Responses: Generates supportive, trauma-informed responses
- Resource Matching: Provides relevant crisis resources and helplines
- Safety Planning: Includes immediate safety recommendations when needed
- Self-Harm Crisis: "I want to cut myself tonight. I can't take this pain anymore."
- Suicidal Ideation: "I don't want to live anymore. Everyone would be better off without me."
- Violence Threat: "I'm going to hurt someone who deserves it. They'll pay for what they did."
- Abuse Situation: "He hits me every day and I'm scared. I don't know what to do."
- Overdose Situation: "I took too many pills and I feel really sick. I think I need help."
- Subtle Self-Harm: "I've been scratching myself when I'm stressed. It helps me feel something."
- Passive Suicidal Thoughts: "Sometimes I wish I could just disappear. Life feels so heavy."
- Emotional Abuse: "My partner constantly puts me down and makes me feel worthless."
- Drug Use Concern: "I've been taking more pills than prescribed. I know it's not good but I need them to cope."
- Work Stress: "Work has been really stressful lately. I'm overwhelmed with deadlines."
- Relationship Problems: "My partner and I have been fighting a lot. I don't know if we can work this out."
- General Sadness: "I'm feeling really sad today. Nothing seems to be going right."
-
Load a Demo Scenario
- Select a scenario from the dropdown
- Click "Load Scenario" to populate the text field
- Observe the pre-written crisis situation
-
Analyze the Text
- Click "Analyze for Crisis" to run the detection
- Review the crisis detection results
- Check the Gemma model analysis
-
Review the Response
- Read the generated empathetic response
- Note the provided resources and helplines
- Observe the safety recommendations
-
Test Custom Text
- Clear the text field
- Enter your own test message
- Repeat the analysis process
- 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
- Crisis Level: none, low, medium, high
- Immediate Risk: True/False
- Analysis: AI-generated assessment of the situation
- Confidence: Model's confidence in the analysis
- 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
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
Evaluate the quality of generated responses:
Check for:
- Empathetic and supportive tone
- Appropriate resource recommendations
- Safety planning for high-risk situations
- Non-judgmental language
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
- Model: Google Gemma-2B (simulated)
- Device: CPU/GPU detection
- Processing: On-device only
- Privacy: Complete local processing
- Immediate Risk: 0.8+ confidence
- High Risk: 0.6+ confidence
- Medium Risk: 0.4+ confidence
- Low Risk: 0.2+ confidence
- Templates: Pre-defined empathetic responses
- Resource Matching: Crisis-specific helplines
- Safety Planning: Immediate action recommendations
- 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
- 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
- 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
- Clear Crisis: 90%+ accuracy
- Non-Crisis: 95%+ accuracy
- Subtle Crisis: 80%+ accuracy
- Empathetic Tone: Supportive, non-judgmental
- Resource Relevance: Appropriate crisis resources
- Safety Planning: Clear action steps for high-risk situations
- On-Device Processing: 100% local processing
- No Data Transmission: Zero external communication
- Temporary Storage: No permanent data retention
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
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.