plugins/hume-ai/README.md
A Python FastAPI service that receives real-time audio from Omi devices, analyzes emotions using Hume AI, sends automatic notifications, and provides a beautiful dashboard with emotion statistics.
Choose your deployment method:
Step 1: Get Your API Keys
Hume AI (Required)
Omi Integration (Required for Notifications)
Step 2: Deploy to Render
# Required
HUME_API_KEY=your_hume_api_key
OMI_APP_ID=your_omi_app_id
OMI_API_KEY=your_omi_api_key
Step 3: Configure Omi App
Part A: Enable Audio Streaming
https://your-app-name.onrender.com/audio
5Part B: Create Omi App for Notifications
https://your-app-name.onrender.com/audio
https://your-app-name.onrender.com
Part C: Get API Credentials
Part D: Update Render Environment Variables
OMI_APP_ID = paste your App IDOMI_API_KEY = paste your API KeyStep 4: Verify It's Working
https://your-app-name.onrender.comStep 1: Clone and Install
# Clone repository
git clone https://github.com/your-username/audio-sentiment-profiling.git
cd audio-sentiment-profiling
# Install dependencies
pip install -r requirements.txt
# Install ffmpeg
brew install ffmpeg # macOS
sudo apt-get install ffmpeg # Linux
Step 2: Configure Environment
# Copy example environment file
cp .env.example .env
# Edit .env with your API keys
nano .env
Add your keys to .env:
HUME_API_KEY=your_hume_api_key_here
OMI_APP_ID=your_omi_app_id_here
OMI_API_KEY=your_omi_api_key_here
Step 3: Start the Server
# Option 1: Direct run
python main.py
# Option 2: Using start script
./start_server.sh
Server will start at http://localhost:8080
Step 4: Expose with ngrok (for Omi device to connect)
# In a new terminal
ngrok http 8080
# Copy the ngrok URL (e.g., https://abc123.ngrok.io)
Step 5: Configure Omi App
https://your-ngrok-url.ngrok.io/audio
Step 6: Test It
http://localhost:8080 in your browser# Build image
docker build -t omi-emotion-ai .
# Run container
docker run -d -p 8080:8080 \
-e HUME_API_KEY=your_key \
-e OMI_APP_ID=your_app_id \
-e OMI_API_KEY=your_api_key \
--name omi-emotion \
omi-emotion-ai
# View logs
docker logs -f omi-emotion
Then configure Omi app to point to your Docker host's URL.
This plugin uses Hume AI's Speech Prosody Model to analyze vocal tone and emotion from audio recordings.
User speaks โ Omi records โ Sends to your server
โ
Analyze with Hume AI Speech Prosody
โ
Detect emotions in top 3
โ
Match against configured list
โ
Send notification automatically!
โ
๐ฑ User receives emotion alert
By default, notifications are sent for ALL emotions detected in the top 3. The system is configured in emotion_config.json:
{
"notification_enabled": true,
"emotion_thresholds": {},
"notification_message_template": "๐ญ Emotion Alert: Detected {emotions}"
}
Empty thresholds = notify for ALL top 3 emotions!
Edit emotion_config.json to notify only for specific emotions:
{
"notification_enabled": true,
"emotion_thresholds": {
"Joy": 0.5,
"Anger": 0.6,
"Sadness": 0.5
}
}
Method 1: Environment Variable (Recommended for Cloud/Render)
Best for persistent configuration that survives restarts.
In Render Dashboard โ Environment:
EMOTION_NOTIFICATION_CONFIG={"notification_enabled":true,"emotion_thresholds":{"Joy":0.5,"Anger":0.7}}
Method 2: File (Local Development Only)
Edit emotion_config.json and restart server:
{
"notification_enabled": true,
"emotion_thresholds": {
"Joy": 0.5,
"Anger": 0.7
}
}
Method 3: API (Temporary - Lost on Restart)
For testing only - changes are lost when container restarts:
# View config
curl https://your-app.onrender.com/emotion-config
# Update config (temporary!)
curl -X POST https://your-app.onrender.com/emotion-config \
-H "Content-Type: application/json" \
-d '{"notification_enabled": true, "emotion_thresholds": {"Joy": 0.5}}'
โ ๏ธ Note: API changes don't persist in cloud deployments. Use environment variables for permanent configuration.
Option 1: Update Environment Variable (Permanent)
Changes persist across restarts:
EMOTION_NOTIFICATION_CONFIG{"notification_enabled":true,"emotion_thresholds":{"Joy":0.6,"Anger":0.8}}
โ Permanent - survives restarts
Option 2: Use API Endpoint (Temporary)
Instant update without redeploying:
curl -X POST https://your-app-name.onrender.com/emotion-config \
-H "Content-Type: application/json" \
-d '{
"notification_enabled": true,
"emotion_thresholds": {
"Joy": 0.6,
"Anger": 0.8
}
}'
โ Instant - takes effect immediately โ Temporary - lost on restart/redeploy
Good for: Quick testing and trying different thresholds before committing
Access at: https://your-app.onrender.com/
๐ค Omi Audio Streaming Service ONLINE
โ๏ธ Configuration Status
โ Hume AI API Key: Configured
โ Omi Integration: Configured
16 Total Requests | 12 Successful | 4 Failed
๐ Last Activity
Time: 2025-11-02 18:52:54 UTC
User ID: XqBKRatqZ5MS4tsX84VfBEne16W2
[Joy (0.23)] [Calmness (0.18)] [Interest (0.15)]
๐ญ Emotion Statistics
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Joy Count: 15 | 25.0% โโโโโโโโโโโโโโโโ
Calmness Count: 12 | 20.0% โโโโโโโโโโโโโโ
Interest Count: 10 | 16.7% โโโโโโโโโโโโ
Excitement Count: 8 | 13.3% โโโโโโโโโ
Satisfaction Count: 7 | 11.7% โโโโโโโโ
Hume AI detects 48+ emotions including:
Positive: Joy, Amusement, Satisfaction, Excitement, Pride, Triumph, Relief, Romance, Desire, Admiration, Adoration
Negative: Anger, Sadness, Fear, Disgust, Anxiety, Distress, Shame, Guilt, Embarrassment, Contempt
Neutral: Calmness, Concentration, Contemplation, Determination, Interest, Surprise, Confusion, Realization
{
"emotion_thresholds": {
"Anger": 0.8,
"Fear": 0.85,
"Distress": 0.8
}
}
โ Only high-intensity negative emotions
{
"emotion_thresholds": {
"Sadness": 0.5,
"Anxiety": 0.55,
"Distress": 0.5
}
}
โ Early detection of emotional distress
{
"emotion_thresholds": {
"Joy": 0.7,
"Pride": 0.75,
"Triumph": 0.8
}
}
โ Celebrate achievements!
{
"emotion_thresholds": {}
}
โ Notify for ALL top 3 emotions
You can customize which emotions trigger notifications by editing emotion_config.json:
Notify for ALL emotions (default):
{
"notification_enabled": true,
"emotion_thresholds": {}
}
Notify only for specific emotions:
{
"notification_enabled": true,
"emotion_thresholds": {
"Joy": 0.5,
"Anger": 0.6,
"Sadness": 0.5
}
}
Threshold Guidelines:
Since Hume AI predicts across 48 emotions, scores are typically lower:
๐ก Tip: Start with thresholds around 0.30-0.40 for reliable notifications
To prevent notification spam, the system enforces a 30-second cooldown between automatic notifications. This means after sending a notification, the system will wait 30 seconds before sending another one, even if emotions are detected.
How to Change the Cooldown:
Edit app.py line 53:
# Notification cooldown in seconds (configurable)
NOTIFICATION_COOLDOWN_SECONDS = 30 # Change to your preferred interval
Examples:
60 = 1 minute cooldown120 = 2 minutes cooldown300 = 5 minutes cooldownNote: The "๐ Send Notification" button on the dashboard is for testing purposes and bypasses the cooldown to send immediately.
All available environment variables:
HUME_API_KEY=your_hume_api_key_here # From platform.hume.ai
OMI_APP_ID=your_omi_app_id_here # From Omi mobile app
OMI_API_KEY=your_omi_api_key_here # From Omi mobile app
EMOTION_NOTIFICATION_CONFIG={"notification_enabled":true,"emotion_thresholds":{}} # Emotion notification settings (JSON)
Main Endpoints:
POST /audio - Receive audio from Omi (main webhook)GET / - Dashboard with statisticsGET /health - Health checkGET /status - JSON status and statsPOST /analyze-text - Analyze text emotionsGET /emotion-config - View notification configPOST /emotion-config - Update notification configPOST /reset-stats - Reset all statisticsCheck 1: Render Environment Variables
# Verify these are set in Render Dashboard โ Environment:
OMI_APP_ID=...
OMI_API_KEY=...
Check 2: Omi App Enabled
Check 3: Check Logs Look for in Render logs:
๐ Notification check: should_notify=True, has_predictions=True
Using config emotion filters: {}
๐ Trigger check result: triggered=True, count=3
โ Sent Omi notification to user
Check 4: Verify URL
โ
https://your-app.onrender.com/audio
โ https://your-app.onrender.com/audio?send_notification=true?sample_rate=16000
(No extra parameters needed!)
Already fixed! The service automatically chunks audio >5 seconds into 4.5s segments.
Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)/status endpoint for current statsHume API Limits:
Contributing:
audio-sentiment-profiling/
โโโ main.py # Main FastAPI server (1800+ lines)
โ โโโ Configuration & Setup
โ โโโ Audio Processing Functions
โ โโโ Hume AI Integration
โ โโโ Omi Notifications & Memories
โ โโโ API Endpoints (/audio, /status, etc.)
โ โโโ Dashboard HTML
โโโ emotion_config.json # Emotion detection configuration
โโโ setup.py # Python package setup
โโโ requirements.txt # Python dependencies
โโโ Dockerfile # Docker configuration
โโโ render.yaml # Render deployment config
โโโ start_server.sh # Server startup script
โโโ .env.example # Environment variables template
โโโ LICENSE # MIT License
โโโ README.md # Main documentation (this file)
โโโ tests/ # Test scripts
โ โโโ test_chunking.py
โ โโโ test_notification.py
โ โโโ test_omi_now.py
โโโ image/ # Screenshots
โโโ video/ # Demo videos
Your app will be live at: https://your-app-name.onrender.com
docker build -t omi-emotion-ai .
docker run -p 8080:8080 \
-e HUME_API_KEY=... \
-e OMI_APP_ID=... \
-e OMI_API_KEY=... \
omi-emotion-ai
Run tests to verify your setup:
# Test notification sending
python tests/test_notification.py
# Test audio chunking
python tests/test_chunking.py path/to/audio.wav
# Quick Omi notification test
python tests/test_omi_now.py
MIT License - see LICENSE file for details
Made with โค๏ธ for better emotional awareness
For questions or issues, please open an issue on GitHub!