sentiment_analyzer / README.md
shudipto001's picture
Update README.md
25ddd72 verified

A newer version of the Gradio SDK is available: 6.1.0

Upgrade
metadata
title: Emotion Analysis App
emoji: 😊
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 6.0.2
app_file: app.py
pinned: false

Emotion Analysis App

A sophisticated web application for analyzing emotions in text using zero-shot classification. Built with Gradio and powered by Facebook's BART-Large-MNLI model.

Setup

  1. Clone or download this repository

  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Run the app:

    python app.py
    

    The first run will download the model from Hugging Face Hub (about 1.5GB).

  4. Open your browser and navigate to http://localhost:7860

How It Works

Enter text and the model will:

  1. Perform zero-shot classification across 27 emotion categories
  2. Display the dominant emotion with confidence percentage
  3. Show a complete breakdown table of all emotions
  4. Provide visual comparisons (radar chart and bar chart)

Emotions Detected

Admiration, Adoration, Aesthetic Appreciation, Amusement, Anger, Anxiety, Awe, Awkwardness, Boredom, Calmness, Confusion, Craving, Disgust, Empathic Pain, Entrancement, Excitement, Fear, Horror, Interest, Joy, Nostalgia, Relief, Romance, Sadness, Satisfaction, Sexual Desire, Surprise

Model Information

  • Model: facebook/bart-large-mnli (BART Large trained on MNLI)
  • Task: Zero-shot classification
  • Input Size: Supports up to 512 tokens (text automatically truncated)

Files

  • app.py - Main application
  • requirements.txt - Dependencies

Notes

  • Model: Automatically downloads from Hugging Face Hub on first run
  • Best Results: Works best with English text
  • GPU Support: Automatically detects and uses GPU if available for faster inference
  • Performance: With GPU, processing is near-instant; on CPU, may take a few seconds

Developed by

SUDIPTA ROY