--- 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: file=@sample.wav 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.