Monitor and visualize real-time customer sentiment using AI-powered emotion detection. This Streamlit-based dashboard enables customer support teams to analyze text input, detect emotions, and gain insights with visualizations like emotion count bar charts, word clouds, and heatmaps.
-
🔍 Real-Time Emotion Analysis — Enter customer messages and get instant emotion predictions using a backend API.
-
📊 Emotion Count Bar Chart — View distribution of emotions across all messages.
-
☁️ Word Cloud — Visualize the most frequently used words in all collected messages.
-
🔥 Emotion Heatmap — Analyze emotion trends by hour of the day.
-
Frontend: Streamlit
-
Backend: FastAPI
-
Visualization: Plotly, seaborn, matplotlib, wordcloud
-
Database: SQLite (via SQLAlchemy)
-
ML Model: Pre-trained emotion classifier (e.g., from transformers)
sentiment-watchdog/
│
├── backend/
│ ├── init_db.py # Database initialization script
│ ├── app.py # FastAPI server
│ ├── db.py # SQLite database schema & functions
│ ├── slack_alert.py # Slack notification logic
│ ├── live_stream.py # Simulated/live message stream
│ ├── check_logs.py # Log analysis & trigger evaluation
│
├── models/ # Models folder (new)
│ ├── sentiment_model.py # Emotion detection logic
│ ├── sqlalchemy_model.py # SQLAlchemy ORM models
│
├── dashboard/
│ ├── dashboard.py # Streamlit frontend
│
├── data/
│ └── sentiment.db # SQLite database file
│
├── requirements.txt # Python dependencies
├── .env # Environment variables (API keys, secrets)
├── sample_tickets.json # Sample input data for testing
└── README.md
- Clone the Repository
bash
git clone https://github.com/your-username/sentiment-watchdog.git
cd sentiment-watchdog
- Set Up Virtual Environment
bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
- Start the Backend API
bash
cd backend
uvicorn main:app --reload
Backend will be available at http://127.0.0.1:8000.
- Launch the Dashboard
bash
cd ../dashboard
streamlit run dashboard.py
Dashboard will open in your browser.
You can test with various user inputs like:
json
{
"message": "I’m absolutely thrilled with the service!"
}
json
{
"message": "This is the worst experience I’ve ever had."
}
-
Ensure sentiment.db is created and accessible. If not, check db.py for correct path.
-
Emotion labels typically include: joy, sadness, anger, fear, love, surprise, etc.
-
Backend must be running before using the Streamlit dashboard.
Created by [Suhas P R].
Built using Streamlit, FastAPI, and HuggingFace Transformers.