A web-based demonstration of an AI therapy assistant with speech recognition, emotional state detection, and offline capabilities.
This project demonstrates a therapy assistant interface that can:
- Accept text and voice input
- Provide supportive responses using an mT5 language model
- Detect and display emotional states through visual feedback
- Operate completely offline after initial setup
- Provide debugging and development tools
Created by the CALMe Team for educational and demonstration purposes.
© 2025 CALMe Team - All rights reserved.
This software is provided for educational, evaluation, and non-commercial use only. It is intended as a demonstration project for the AI Therapy Assistant Demo created during a hackathon.
You may:
- View, use, and modify the code for personal or team development
- Share the project for educational or demo purposes with attribution
You may NOT:
- Use this software for commercial purposes
- Redistribute without explicit written permission
- Remove or alter the license notice
See the LICENSE file for complete terms.
- Visit the GitHub Pages demo (once hosted)
- Allow microphone access when prompted
- Wait for models to load (first time may take 2-3 minutes)
- Start chatting via text or voice
-
Clone this repository:
git clone https://github.com/JoshWrites/CALMe_SLM.git cd CALMe_SLM -
Serve the
docs/folder using a local web server:# Python 3 python -m http.server 8000 --directory docs # Or using Node.js npx serve docs
-
Open http://localhost:8000 in your browser
For offline use without internet dependency:
- Download the offline package
- Extract the ZIP file
- Open
index.htmlin your browser - No web server required for offline version
Minimum Requirements:
- Modern web browser (Chrome 88+, Firefox 78+, Safari 14+, Edge 88+)
- 4GB RAM (8GB recommended)
- 200MB free storage space
- Microphone for voice features (optional)
Recommended for Best Experience:
- Chrome or Edge browser
- 8GB+ RAM
- SSD storage
- Stable internet connection for initial model download
- Text Input: Type messages using the text input field
- Voice Input: Click microphone button for speech-to-text
- AI Responses: Contextual therapy-style responses using mT5 model
- Conversation History: Persistent chat history during session
- Privacy: All processing happens locally after model download
- Visual Feedback: Emoji-style faces showing detected emotions
- Real-time Updates: Instant switching based on conversation tone
- Four States: Happy, Listening, Sad, Mad
- Keyword-based: Simple but effective emotion detection
- Offline Processing: Uses VOSK WebAssembly for local speech recognition
- Multiple Modes: Push-to-talk or toggle recording modes
- Audio Visualization: Real-time audio level display
- Auto-stop: Configurable silence detection
- Mobile Support: Optimized for mobile browsers
- Debug Console: Real-time logging and performance metrics
- Testing Suite: Built-in emotion detection tests
- Performance Monitoring: Memory usage, response times
- Export Logs: Download debug information for analysis
To host your own copy:
- Fork this repository
- Go to repository Settings → Pages
- Set source to "Deploy from a branch"
- Select
mainbranch and/docsfolder - Your demo will be available at
https://yourusername.github.io/CALMe_SLM
The demo is designed for easy model replacement:
- mT5-small: Downloaded from Hugging Face Hub (~600MB)
- VOSK English: Included in repository (~45MB)
- Prepare your model: Convert to ONNX format if needed
- Update config: Modify
docs/config.js:CONFIG.models.mt5.source = "local"; CONFIG.models.mt5.local_path = "./models/your-model.onnx";
- Place model file: Copy to
docs/models/ - Clear cache: Use browser dev tools or incognito mode
- Test: Reload and verify functionality
See SWAP-MODEL-INSTRUCTIONS.md for detailed steps.
Models won't load:
- Check internet connection for initial download
- Clear browser cache and reload
- Try incognito/private browsing mode
- Ensure sufficient free storage space
Microphone not working:
- Grant microphone permissions in browser
- Check browser compatibility (Chrome/Edge recommended)
- Test with different microphone if available
- Ensure HTTPS or localhost (required for microphone access)
Performance issues:
- Close other browser tabs/applications
- Use Chrome or Edge for best performance
- Ensure sufficient RAM available
- Try the debug console for performance metrics
Emotional states not changing:
- Use clear emotional language in messages
- Check the debug console for emotion detection logs
- Try the test phrases in debug mode
- Enable debug mode: Add
?debug=trueto URL - Check the debug console for error messages
- Export debug logs for analysis
- Review the DEBUG-GUIDE.md
- No external servers: All processing happens in your browser
- Local storage only: Conversations stored locally, not transmitted
- Model caching: Downloaded models cached for performance
- No telemetry: No usage data sent to external services
- Offline operation: Works without internet after setup
- Local processing: AI inference runs entirely in browser
- No API keys: No external API dependencies
- Open source: All code available for review
CALMe_SLM/
├── docs/ # GitHub Pages source
│ ├── index.html # Main application
│ ├── styles.css # UI styling
│ ├── script.js # Main application logic
│ ├── config.js # Configuration
│ ├── model-loader.js # AI model management
│ ├── audio-processor.js # Speech recognition
│ ├── debug-console.js # Debug features
│ ├── lib/ # External libraries
│ ├── models/ # Model files (cached)
│ ├── images/ # Emotional state images
│ └── download/ # Offline package
├── scripts/ # Build and utility scripts
├── LICENSE # License terms
└── README.md # This file
Adding new emotions:
- Create new SVG image in
docs/images/ - Add keywords to emotion detection in
script.js - Update CSS if needed for new states
Modifying responses:
- Update the response generation in
model-loader.js - Add new response patterns or improve existing ones
- Test with various input types
Adding features:
- Follow existing code patterns and conventions
- Add appropriate debug logging
- Update configuration in
config.js - Test thoroughly across browsers
Enable detailed logging and performance monitoring:
- URL parameter: Add
?debug=trueto any page URL - Console toggle: Click the Debug button in the header
- Features available:
- Real-time performance metrics
- Detailed logging with timestamps
- Memory usage monitoring
- Built-in test suite
- Log export functionality
See DEBUG-GUIDE.md for comprehensive debugging information.
- Emotion detection: Tests all four emotional states
- Model loading: Validates model initialization
- Audio pipeline: Tests speech recognition components
- Performance: Memory and timing validation
- Application loads without errors
- Models download and initialize successfully
- Text input and responses work
- Voice input records and transcribes
- Emotional states change appropriately
- Debug console shows relevant information
- Settings modal opens and saves preferences
- Conversation can be cleared and copied
Created by CALMe Team
- Original concept and implementation
- UI/UX design and development
- Model integration and optimization
- Documentation and testing
Technologies Used:
- VOSK for speech recognition
- ONNX.js for model inference
- mT5 for language generation
- Pure HTML5, CSS3, and JavaScript
For questions, licensing inquiries, or commercial use, contact the CALMe Team.
This project was created as a demonstration of AI therapy assistant capabilities. It is not intended to replace professional mental health services and should not be used for actual therapy or medical advice.