An intelligent, multi-modal sentiment analysis tool built with Streamlit, Transformers, and Whisper. This platform doesn't just read text; it understands emotion, sarcasm, and even the tone of voice from video and audio files.
This platform provides a deep, comprehensive understanding of sentiment by combining multiple AI models.
- ✨ Multi-Modal Analysis: Analyze text, audio (
.mp3,.wav), and video (.mp4) files. - 📈 Hybrid Scoring: Combines the power of RoBERTa (a Transformer model) with the speed of VADER (a rule-based model) for a more accurate and nuanced sentiment score.
- 🎯 Aspect-Based Sentiment: Goes beyond a simple overall score. It finds what you're talking about (e.g., "camera," "battery life") and analyzes the sentiment for each specific aspect.
- 🎬 File & YouTube Analysis: Upload your own files or just paste a YouTube URL to download, transcribe, and analyze the content.
- 🗣️ Speech Emotion Recognition: It's not just what you say, but how you say it. The tool analyzes the audio's tone to detect emotions like joy, sadness, or anger.
- 🧐 Sarcasm Detection: A dedicated model looks for irony and sarcasm, warning you if the positive words might not mean what you think.
- 🤖 Sentiment-Aware Chatbot: Have a conversation with an AI that understands the emotion behind your messages.
This app's power comes from a "committee" of AI models that work together.
- Input: You provide text, a file, or a URL.
- Transcription: If it's audio or video, OpenAI's Whisper model creates a highly accurate text transcript.
- Sentiment Analysis:
- RoBERTa and VADER analyze the text for a hybrid sentiment score.
- BERT (a 43-label emotion model) detects emotions like joy, anger, or admiration.
- A Sarcasm-detection model flags potential irony.
- Speech Analysis: A Wav2Vec2 model analyzes the raw audio (from the file or video) to find the emotion in the tone of voice.
- NLP: SpaCy is used to break down sentences and find the "aspects" (noun chunks) for analysis.
- Output: All this information is presented in a clean, interactive dashboard with charts and detailed breakdowns.
This project has been refactored for clarity, maintainability, and scalability. The logic is now separated from the user interface.
app.py: The frontend of the application. This file contains all the Streamlit code responsible for the user interface (UI), such as pages, buttons, charts, and layout.analysis_logic.py: The backend "brain" of the application. This file contains all the core data processing and AI functions (model loading, text analysis, web scraping, video transcription, etc.).requirements.txt: A list of all required Python packages.
- Clone the Repository:
git clone [https://github.com/Dhy4n-117/Sentiment-Analysis.git] cd Sentiment-Analysis - Install Prerequisites:
-
This project requires FFmpeg (for video/audio) and PortAudio (for voice recording).
-
On Windows:
- Download and install FFmpeg from gyan.dev (get the
ffmpeg-release-full.7zfile). - Extract it and add the
binfolder to your Windows PATH environment variable. pyaudio(for voice) is installed viapip, but it may require you to install "Microsoft C++ Build Tools" if it fails.
- Download and install FFmpeg from gyan.dev (get the
-
On Linux (Debian/Ubuntu):
- Run the following command to install both prerequisites from the terminal:
sudo apt-get update && sudo apt-get install -y ffmpeg portaudio19-dev
- Run the following command to install both prerequisites from the terminal:
-
On macOS:
- Use Homebrew to install:
brew install ffmpeg portaudio
- Use Homebrew to install:
-
- Create and Activate a Virtual Environment:
python -m venv venv .\venv\Scripts\activate
- Install Python Dependencies:
pip install -r requirements.txt
- Download SpaCy Model:
python -m spacy download en_core_web_sm
- Run the App:
streamlit run app.py