--- title: Sentiment Analysis emoji: ๐Ÿข colorFrom: blue colorTo: purple sdk: gradio sdk_version: 5.34.0 app_file: app.py pinned: false license: mit short_description: Analyze sentiment of reviews with a fine-tuned BERT model --- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference # Sentiment Classifier This is a real-time sentiment analysis app built using a fine-tuned BERT model on Amazon product reviews. The app classifies text into **Positive**, **Neutral**, or **Negative** categories and gives confidence scores for transparency. Developed with **Gradio** and deployed on **Hugging Face Spaces**. --- ## ๐Ÿš€ Objective To build and deploy an end-to-end NLP solution that allows users to analyze the sentiment of written product reviews. The app also collects feedback for future model improvements. --- ## ๐Ÿง  Model & Dataset - **Model**: BERT (`bert-base-uncased`) - **Fine-tuned on**: A balanced subset of **104,958 Amazon product reviews** - **Training Framework**: PyTorch with Hugging Face Transformers - **Class Labels**: - `0`: Negative - `1`: Neutral - `2`: Positive --- ## ๐Ÿ“Š Performance | Set | Accuracy | F1 Score | |------------|----------|----------| | Training | 90.44% | 90.50% | | Validation | 83.18% | 83.34% | | Test | 82.88% | 82.99% | --- ## ๐Ÿ–ฅ๏ธ Features - ๐Ÿ“ Sentiment prediction with confidence score - ๐Ÿ“Š Label output: *Positive*, *Neutral*, *Negative* - ๐Ÿ“ Real-time user feedback collection - ๐ŸŽจ Colored label display for intuitive UI - ๐Ÿงช Example review inputs - ๐Ÿ’ฌ Textbox-based input for free-form reviews --- ## ๐Ÿงฐ Tech Stack - Python ๐Ÿ - BERT (Hugging Face Transformers) - PyTorch - Datasets (Kaggle) - Gradio - Google Colab (for training) - Hugging Face Spaces (for deployment) --- ## ๐Ÿ› ๏ธ How to Use 1. Type a product review in the text box. 2. Click "Submit" to see the sentiment and confidence. 3. Optionally, give feedback on whether the prediction was correct. --- ## ๐Ÿ“ Feedback Logging Feedback (correct/incorrect) is stored in a local CSV file named `user_feedback.csv`. This helps track model performance and can be used for future retraining.