Skip to content
SujitSparkPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Emotion-Aware Empathetic Dialogue System

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

Group Members

Name Roll Number
Samar Shahana 123A8052
Abbas Shaihk 123A8053
Soham shinde 123A8054
Sujit 123A8055

Problem Statement

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.

Technologies Used

  • 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.

🌟 System Architecture Overview

 ┌────────────────┐       ┌─────────────────────────┐       ┌────────────────────────┐
 │   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│
                          └─────────────────────────┘

📁 Repository Structure

.
├── 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

🚀 Quickstart Guide

1. Install Dependencies

pip install -r requirements.txt

2. Run the Application

Launch with default settings:

python app.py

Launch with CLI parameters:

python app.py --host 0.0.0.0 --port 7860 --model Qwen/Qwen2.5-3B-Instruct --quant 4bit

Navigate to http://127.0.0.1:7860 in your web browser.


⚙️ Environment Configuration

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

🎯 Empathy Strategies Mapping

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

📤 Pushing to Git Repository

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

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages