Spaces:
Sleeping
A newer version of the Gradio SDK is available:
6.2.0
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: Negative1: Neutral2: 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
- Type a product review in the text box.
- Click "Submit" to see the sentiment and confidence.
- 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.