File size: 2,575 Bytes
e841a30 c85f75b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
---
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
1. POST /analyze-text
Request:
{ "text": "I love the service but delivery was late." }
Response:
[
{ "sentiment": 0.7, "emotion": -0.4, "tone": -0.9 }
]
2. 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.
|