A modular, generalized, production-ready framework for an Emotion-Aware Empathetic Dialogue System built with PyTorch, Hugging Face Transformers, and Gradio.
Group No.: 14
Guide Name: Dr Vidya Keshwani
| Name | Roll Number |
|---|---|
| Samar Shahana | 123A8052 |
| Abbas Shaihk | 123A8053 |
| Soham shinde | 123A8054 |
| Sujit | 123A8055 |
Existing conversational agents often fail to recognize user emotions, resulting in generic and emotionally tone-deaf responses that can alienate users seeking support or empathy. This project aims to develop a modular framework that explicitly maps fine-grained psychological emotions to distinct, actionable empathy strategies before generating the response.
- PyTorch: Core deep learning framework.
- Hugging Face Transformers: For loading RoBERTa-GoEmotions and generative Instruction LLMs (e.g., Qwen, LLaMA, Mistral).
- Gradio: For building an interactive, dark-themed web interface with live telemetry.
- bitsandbytes & accelerate: For efficient 4-bit and 8-bit model quantization.
A modular, generalized, production-ready framework for an Emotion-Aware Empathetic Dialogue System built with PyTorch, Hugging Face Transformers, and Gradio.
┌────────────────┐ ┌─────────────────────────┐ ┌────────────────────────┐
│ User Input │ ────> │ 1. Emotion Classifier │ ────> │ Top Emotion Label & │
│ Utterance │ │ (RoBERTa-GoEmotions) │ │ Confidence Score (%) │
└────────────────┘ └─────────────────────────┘ └───────────┬────────────┘
│
▼
┌────────────────┐ ┌─────────────────────────┐ ┌────────────────────────┐
│ Conversation │ ────> │ 3. Dialogue Generator │ <──── │ 2. Dynamic Strategy & │
│ History Buffer │ │ (LLaMA/Qwen/Mistral) │ │ Conditioned SysPrompt │
└────────────────┘ └────────────┬────────────┘ └────────────────────────┘
│
▼
┌─────────────────────────┐
│ 4. Gradio Web Interface │
│ Chatbot + Live Telemetry│
└─────────────────────────┘
.
├── config.py # Central configuration (env variables & defaults)
├── emotion_classifier.py # PyTorch RoBERTa-GoEmotions module with typo normalizer
├── strategy_mapper.py # Maps 28 GoEmotions to 7 empathy strategies & system prompts
├── generator.py # Hugging Face LLM generator (LLaMA-3.2, Qwen2.5, Mistral, TinyLlama)
├── app.py # Pure OLED dark Gradio web interface & entry point
├── requirements.txt # Production dependencies
├── .gitignore # Git exclusion settings
└── README.md # Repository documentation
pip install -r requirements.txtLaunch with default settings:
python app.pyLaunch with CLI parameters:
python app.py --host 0.0.0.0 --port 7860 --model Qwen/Qwen2.5-3B-Instruct --quant 4bitNavigate to http://127.0.0.1:7860 in your web browser.
You can configure the system using environment variables (or a .env file):
| Environment Variable | Default Value | Description |
|---|---|---|
EMOTION_MODEL_NAME |
SamLowe/roberta-base-go_emotions |
Hugging Face model for emotion classification |
GENERATOR_MODEL_NAME |
Qwen/Qwen2.5-3B-Instruct |
Baseline LLM for empathetic response generation |
QUANTIZATION |
none |
Dynamic quantization level (4bit, 8bit, or none) |
MAX_NEW_TOKENS |
256 |
Maximum generated output tokens |
TEMPERATURE |
0.7 |
LLM generation sampling temperature |
APP_HOST |
0.0.0.0 |
Gradio server binding host address |
APP_PORT |
7860 |
Gradio server binding port number |
| GoEmotions Categories | Empathy Strategy | Target Tone |
|---|---|---|
sadness, grief, disappointment, remorse |
Consoling & Emotional Validation | Warm, gentle, compassionate |
anger, annoyance, disapproval, disgust |
De-escalation & Active Listening | Calm, patient, non-defensive |
fear, nervousness, embarrassment |
Reassurance & Grounding | Reassuring, soothing, steady |
joy, amusement, excitement, pride |
Shared Celebration & Reinforcement | Enthusiastic, vibrant, uplifting |
caring, love, relief, approval |
Warm Reciprocation & Connection | Affectionate, appreciative |
confusion, curiosity, realization |
Clarification & Guided Exploration | Patient, clear, guiding |
neutral |
Attentive Engagement | Empathetic, receptive, open |
To push this repository to GitHub or a remote Git server:
git init
git add .
git commit -m "Initial commit: Emotion-Aware Empathetic Dialogue System"
git branch -M main
git remote add origin <YOUR_GIT_REPOSITORY_URL>
git push -u origin main