Spaces:
Sleeping
title: Sentiment Analysis
emoji: π’
colorFrom: red
colorTo: blue
sdk: docker
pinned: false
license: mit
short_description: 'This project is a Sentiment, Emotion, and Tone Analysis API '
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
π― Overview
This project is a Sentiment, Emotion, and Tone Analysis API powered by NLP + Speech Recognition. It provides a simple way to analyze any text or voice input and outputs three key psychological indicators:
Sentiment β Overall polarity of the text (positive/negative/neutral)
Emotion β Emotional undertone detected (positive/negative/neutral)
Tone β Financial/business tone detection using FinBERT (positive/negative/neutral)
The system returns a clean JSON output with numeric scores in the range -1 to +1, where:
Positive β +value
Negative β -value
Neutral β 0
Example output:
[ { "sentiment": -0.3, "emotion": -0.62, "tone": -1.0 } ]
π Features
Text Analysis
Input plain text and get instant sentiment, emotion, and tone scores.
Voice Analysis
Upload a WAV/AIFF audio file.
The system transcribes it (using speech_recognition free Google Web Speech API).
Runs the transcription through the NLP pipeline.
Unified JSON Output
Strict format for easy integration into any app, dashboard, or pipeline.
Models Used
VADER (NLTK) β Sentiment scoring
tabularisai/multilingual-sentiment-analysis (Hugging Face) β Emotion classification
FinBERT (yiyanghkust/finbert-tone) β Business/financial tone detection
π οΈ Tech Stack
Backend: Python + FastAPI
Libraries: nltk, transformers, torch, SpeechRecognition
Deployment: Hugging Face Spaces (Docker SDK, free CPU)
π‘ Endpoints
- POST /analyze-text
Request:
{ "text": "I love the service but delivery was late." }
Response:
[ { "sentiment": 0.7, "emotion": -0.4, "tone": -0.9 } ]
- POST /analyze-voice
Request:
Form-data upload: [email protected]
Response:
[ { "sentiment": -0.2, "emotion": -0.5, "tone": 0.0 } ]
π Use Cases
Customer support analysis (detect angry vs happy customers).
Financial news / earnings call tone monitoring.
Social media listening (track public mood & emotions).
Personal productivity apps (journal tone/sentiment analysis).
Call center or chatbot integrations.
β‘ Advantages
β Free & lightweight (no paid API required).
β Works on both text & voice.
β Multilingual support for emotions.
β JSON output with strict schema (easy to integrate).
β Deployable on Hugging Face Spaces for free.