Moodify is a Dragon Ball Z themed voice chatbot that detects emotions from your voice and responds with mood-appropriate conversations. Talk to an AI that understands how you're feeling and adapts its responses accordingly!
π€ Voice Emotion Detection - Detects 7 emotions from audio using state-of-the-art ML models
- Happy, Sad, Angry, Fear, Surprise, Disgust, Neutral
π€ AI-Powered Responses - Generates contextual, emotion-aware replies using Groq's LLM
π¨ Dragon Ball Z Theme - Character transformations based on detected emotions
- Super Saiyan for Angry π€
- Ultra Instinct for Happy π
- Base Form for Neutral π
- And more!
π Voice Activity Detection - Automatically sends audio after 3 seconds of silence
π¬ Conversation Memory - Maintains context across the conversation
π Graceful Degradation - Works with audio-only; face detection optional
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β Frontend βββββββΆβ Backend βββββββΆβ Groq API β
β (React UI) β β (FastAPI) β β (LLM) β
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β
βΌ
ββββββββββββββββ
β HuggingFace β
β Audio Model β
ββββββββββββββββ
β
βΌ
ββββββββββββββββ
β CNN Model β
β (Optional) β
ββββββββββββββββ
moodify/
βββ backend/ # FastAPI backend
β βββ app/
β β βββ api/ # API routes
β β βββ core/ # Core utilities
β β βββ models/ # ML models & schemas
β β βββ services/ # Business logic
β β βββ utils/ # Helper functions
β β βββ main.py # App entry point
β βββ trained_models/ # CNN model (optional)
β βββ requirements.txt
β βββ README.md
β
βββ frontend/ # React frontend
βββ src/
β βββ components/ # UI components
β βββ services/ # API clients
β βββ App.jsx
βββ public/
βββ package.json
- Python 3.10+
- Node.js 18+ (for frontend)
- Groq API Key (Get one free)
- Optional: Trained CNN model for face emotion detection
- Clone the repository
git clone https://github.com/ShubrotoDas10/moodify.git
cd moodify/backend- Create virtual environment
python -m venv venv
# Activate on Windows
venv\Scripts\activate
# Activate on Mac/Linux
source venv/bin/activate- Install dependencies
pip install -r requirements.txt- Configure environment
cp .env.example .envEdit .env and add your Groq API key:
GROQ_API_KEY=your_groq_api_key_here- Run the backend
python -m app.mainBackend will start on http://localhost:8000
- Navigate to frontend
cd ../frontend- Install dependencies
npm install- Start development server
npm run devFrontend will start on http://localhost:5173
- Open the app in your browser (
http://localhost:5173) - Allow microphone access when prompted
- Press the mic button and start talking
- Stop talking and wait 3 seconds - your message will auto-send
- Watch Goku transform based on your emotion!
- See the AI response tailored to your mood
| Endpoint | Method | Description |
|---|---|---|
/chat/audio |
POST | Send audio, get emotion + response |
/chat/text |
POST | Text-only chat (fallback) |
/audio/detect-emotion |
POST | Audio emotion detection only |
/health/models |
GET | Check backend status |
curl -X POST "http://localhost:8000/chat/audio" \
-F "audio=@recording.wav"Response:
{
"emotion": {
"emotion": "happy",
"confidence": 0.87,
"probabilities": {...}
},
"chat_response": {
"message": "That's wonderful! Keep that positive energy!",
"emotion_detected": "happy"
}
}See full API Documentation
- FastAPI - High-performance web framework
- PyTorch - ML model inference
- HuggingFace Transformers - Audio emotion detection
- OpenCV - Face detection (optional)
- Groq API - LLM for response generation
- librosa - Audio processing
- React - UI framework
- Web Audio API - Voice recording
- Fetch API - Backend communication
- CSS3 - Dragon Ball Z themed styling
| Emotion | Character State |
|---|---|
| π€ Angry | Super Saiyan Goku (Golden aura) |
| π Happy | Ultra Instinct Goku (Silver glow) |
| π’ Sad | Base Goku (Looking down) |
| π° Fear | Injured Goku (Worried) |
| π² Surprise | Shocked Goku (Wide eyes) |
| π€’ Disgust | Annoyed Vegeta (Scowling) |
| π Neutral | Base Goku (Relaxed) |
curl http://localhost:8000/healthcurl -X POST "http://localhost:8000/chat/audio" \
-F "audio=@test_audio.wav"cd backend
pytestMoodify works great with audio-only, but you can add face emotion detection:
- Train or obtain a CNN model for emotion recognition
- Place model file in
backend/trained_models/cnn_face_emotion.pth - Restart backend - it will automatically load the CNN
See CNN_OPTIONAL.md for details.
# Fix NumPy compatibility issue
pip install "numpy<2"
pip install opencv-python-headless==4.9.0.80- Ensure backend is running on port 8000
- Check CORS settings in
.env - Try
http://localhost:8000/healthin browser
- Use HTTPS in production (required for mic access)
- Check browser permissions
- Ensure site is not blocked
- This is OK! Backend works with audio-only
- Check logs for "β CNN model not available"
- See CNN_OPTIONAL.md
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
GROQ_API_KEY=your_groq_api_key # Required
HF_TOKEN=your_hf_token # Optional
CNN_MODEL_PATH=./trained_models/cnn_face_emotion.pth # Optional
AUDIO_CONFIDENCE_THRESHOLD=0.70
MAX_AUDIO_SIZE_MB=10
ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5173- Voice Input β User speaks into microphone
- VAD β Frontend detects 3 seconds of silence
- Audio Sent β WAV file sent to
/chat/audioendpoint - Emotion Detection β HuggingFace model analyzes audio
- Response Generation β Groq LLM creates mood-appropriate response
- Character Update β Frontend displays matching DBZ character
- Chat Display β Message shown with emotion badge
- Never commit
.envfiles - Use environment variables for API keys
- Enable CORS only for trusted origins
- Validate all file uploads
- Use HTTPS in production
- Emotion Detection: ~1-2 seconds
- Response Generation: ~2-3 seconds
- Total Response Time: ~3-5 seconds
- Supports: Multiple concurrent users
- Docker:
docker-compose up -d - Railway/Render: Connect GitHub repo
- AWS/GCP: Use provided Dockerfile
- Vercel:
npm run buildβ Deploy - Netlify: Connect GitHub repo
- Cloudflare Pages: Auto-deploy on push
- Multi-language support
- Voice synthesis for AI responses
- Mobile app (React Native)
- Advanced emotion analytics
- Custom character themes
- Real-time conversation insights
- Group chat support
This project is licensed under the MIT License - see the LICENSE file for details.
Shubroto Das
- GitHub: @ShubrotoDas10
- Groq - For fast LLM inference
- HuggingFace - For emotion detection models
- Dragon Ball Z - For character inspiration
- FastAPI - For the amazing framework
If you have questions or need help:
- Open an Issue
- Check Discussions
- Read the Documentation
Made with β€οΈ by Shubroto Das
If you found this project helpful, please consider giving it a β!