Spaces:
Runtime error
Runtime error
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,12 +1,146 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: E-commerce Sentiment Analysis
|
| 3 |
+
emoji: 🛍️
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
+
tags:
|
| 12 |
+
- sentiment-analysis
|
| 13 |
+
- nlp
|
| 14 |
+
- ecommerce
|
| 15 |
+
- transformers
|
| 16 |
+
- gradio
|
| 17 |
+
- machine-learning
|
| 18 |
+
short_description: AI sentiment analysis for e-commerce product reviews
|
| 19 |
---
|
| 20 |
|
| 21 |
+
# 🛍️ E-commerce Sentiment Analysis
|
| 22 |
+
|
| 23 |
+
An AI-powered sentiment analysis tool specifically designed for e-commerce product reviews. This application uses state-of-the-art transformer models to analyze the sentiment of customer reviews and provides insights by showing similar reviews from a database.
|
| 24 |
+
|
| 25 |
+
## 🚀 Features
|
| 26 |
+
|
| 27 |
+
- **Advanced Sentiment Analysis**: Uses pre-trained RoBERTa models fine-tuned for sentiment analysis
|
| 28 |
+
- **Similar Review Discovery**: Finds and displays similar reviews using embedding-based search
|
| 29 |
+
- **User-Friendly Interface**: Clean, intuitive Gradio interface for easy interaction
|
| 30 |
+
- **Real-time Processing**: Fast analysis with immediate results
|
| 31 |
+
- **Sample Reviews**: Pre-loaded examples to get you started quickly
|
| 32 |
+
|
| 33 |
+
## 🎯 How to Use
|
| 34 |
+
|
| 35 |
+
1. **Enter Review Text**: Type or paste a product review in the text area
|
| 36 |
+
2. **Optional Image**: Upload a product image (feature in development)
|
| 37 |
+
3. **Analyze**: Click the "Analyze Sentiment" button
|
| 38 |
+
4. **View Results**: See the sentiment classification, confidence score, and similar reviews
|
| 39 |
+
|
| 40 |
+
## 📊 Sentiment Categories
|
| 41 |
+
|
| 42 |
+
The model classifies reviews into three categories:
|
| 43 |
+
|
| 44 |
+
- **😊 POSITIVE**: Indicates customer satisfaction and approval
|
| 45 |
+
- **😐 NEUTRAL**: Neither strongly positive nor negative sentiment
|
| 46 |
+
- **😞 NEGATIVE**: Indicates dissatisfaction or disapproval
|
| 47 |
+
|
| 48 |
+
## 🔧 Technology Stack
|
| 49 |
+
|
| 50 |
+
- **Frontend**: Gradio for interactive web interface
|
| 51 |
+
- **Models**:
|
| 52 |
+
- Sentiment Analysis: `cardiffnlp/twitter-roberta-base-sentiment-latest`
|
| 53 |
+
- Embeddings: OpenAI CLIP for similarity search
|
| 54 |
+
- **Backend**: PyTorch, Transformers, FAISS for vector search
|
| 55 |
+
- **Deployment**: Hugging Face Spaces
|
| 56 |
+
|
| 57 |
+
## 🏗️ Architecture
|
| 58 |
+
|
| 59 |
+
This application is part of a larger microservices-based e-commerce sentiment analysis system that includes:
|
| 60 |
+
|
| 61 |
+
- **Data Collection Service**: Scrapes and collects product reviews
|
| 62 |
+
- **Data Processing Service**: Cleans and preprocesses review data
|
| 63 |
+
- **Model Training Service**: Trains custom sentiment models
|
| 64 |
+
- **Retrieval Service**: Handles similarity search and embeddings
|
| 65 |
+
- **Inference Service**: Performs sentiment analysis
|
| 66 |
+
- **Frontend Service**: User interface (this Gradio app)
|
| 67 |
+
|
| 68 |
+
## 📈 Performance
|
| 69 |
+
|
| 70 |
+
The sentiment analysis model achieves:
|
| 71 |
+
- High accuracy on e-commerce review datasets
|
| 72 |
+
- Fast inference times (< 1 second per review)
|
| 73 |
+
- Robust handling of informal language and product-specific terminology
|
| 74 |
+
|
| 75 |
+
## 🔄 Continuous Integration/Deployment
|
| 76 |
+
|
| 77 |
+
This space is automatically updated through GitHub Actions CI/CD pipeline:
|
| 78 |
+
|
| 79 |
+
- **Automated Testing**: Runs comprehensive tests on model performance
|
| 80 |
+
- **Security Scanning**: Vulnerability scanning with Trivy
|
| 81 |
+
- **Automated Deployment**: Direct deployment to Hugging Face Spaces
|
| 82 |
+
- **Docker Support**: Containerized deployment options available
|
| 83 |
+
|
| 84 |
+
## 📝 Example Reviews
|
| 85 |
+
|
| 86 |
+
Try these sample reviews to see the system in action:
|
| 87 |
+
|
| 88 |
+
1. **Positive**: "This product exceeded my expectations! The quality is outstanding and it arrived earlier than expected."
|
| 89 |
+
|
| 90 |
+
2. **Negative**: "Terrible experience with this item. It broke after one use and customer service was unhelpful."
|
| 91 |
+
|
| 92 |
+
3. **Neutral**: "The product is okay, but not worth the price. Shipping was fast though."
|
| 93 |
+
|
| 94 |
+
## 🛠️ Development
|
| 95 |
+
|
| 96 |
+
### Local Setup
|
| 97 |
+
|
| 98 |
+
```bash
|
| 99 |
+
# Clone the repository
|
| 100 |
+
git clone <repository-url>
|
| 101 |
+
cd ecommerce_sentiment_agent
|
| 102 |
+
|
| 103 |
+
# Install dependencies
|
| 104 |
+
pip install -r hf_space_requirements.txt
|
| 105 |
+
|
| 106 |
+
# Run the application
|
| 107 |
+
python hf_space_app.py
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
### API Usage
|
| 111 |
+
|
| 112 |
+
The Gradio interface also provides an API endpoint:
|
| 113 |
+
|
| 114 |
+
```python
|
| 115 |
+
import requests
|
| 116 |
+
|
| 117 |
+
response = requests.post(
|
| 118 |
+
"https://huggingface.co/spaces/<username>/ecommerce-sentiment-analysis/api/predict",
|
| 119 |
+
json={"data": ["Your review text here", None]}
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
result = response.json()
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
## 🤝 Contributing
|
| 126 |
+
|
| 127 |
+
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
|
| 128 |
+
|
| 129 |
+
## 📄 License
|
| 130 |
+
|
| 131 |
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
| 132 |
+
|
| 133 |
+
## 🙏 Acknowledgments
|
| 134 |
+
|
| 135 |
+
- Hugging Face for the amazing Transformers library and Spaces platform
|
| 136 |
+
- Cardiff NLP team for the pre-trained sentiment analysis model
|
| 137 |
+
- OpenAI for the CLIP model used in similarity search
|
| 138 |
+
- The open-source community for the various tools and libraries used
|
| 139 |
+
|
| 140 |
+
## 📞 Contact
|
| 141 |
+
|
| 142 |
+
For questions or support, please open an issue in the GitHub repository or contact through Hugging Face Spaces.
|
| 143 |
+
|
| 144 |
+
---
|
| 145 |
+
|
| 146 |
+
*Built with ❤️ using Hugging Face Transformers and Gradio*
|