Spaces:
Sleeping
Sleeping
File size: 2,227 Bytes
ba245f4 04eb846 ba245f4 04eb846 ba245f4 04eb846 |
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 |
---
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.
|