Spaces:
Running
Running
title: ABSA Restaurant Reviews (FastAPI) | |
emoji: π½οΈ | |
colorFrom: blue | |
colorTo: green | |
sdk: docker | |
app_port: 7860 | |
pinned: false | |
license: mit | |
models: | |
- ronalhung/setfit-absa-restaurants-aspect | |
- ronalhung/setfit-absa-restaurants-polarity | |
tags: | |
- sentiment-analysis | |
- aspect-based-sentiment-analysis | |
- setfit | |
- restaurant-reviews | |
- nlp | |
- fastapi | |
- react | |
# π½οΈ Aspect-Based Sentiment Analysis for Restaurant Reviews (FastAPI + React) | |
This application performs **Aspect-Based Sentiment Analysis (ABSA)** on restaurant reviews using SetFit models from Hugging Face. | |
**Original FastAPI + React interface** preserved with beautiful modern UI. | |
## Features | |
- π **Text Input**: Enter restaurant reviews directly | |
- π **File Upload**: Upload .txt files containing reviews | |
- π― **Aspect Extraction**: Automatically detect aspects (food, service, atmosphere, etc.) | |
- π **Sentiment Analysis**: Classify sentiment for each aspect (positive, negative, neutral, conflict) | |
- π¨ **Modern UI**: Beautiful React interface with TailwindCSS | |
- β‘ **Fast API**: High-performance backend with FastAPI | |
## Models Used | |
1. **[ronalhung/setfit-absa-restaurants-aspect](https://huggingface.co/ronalhung/setfit-absa-restaurants-aspect)** - Aspect extraction (86.1% accuracy) | |
2. **[ronalhung/setfit-absa-restaurants-polarity](https://huggingface.co/ronalhung/setfit-absa-restaurants-polarity)** - Sentiment classification (69.6% accuracy) | |
## How to Use | |
1. **Text Input**: Type or paste a restaurant review in the text area | |
2. **File Upload**: Click "Upload Text File" to load a .txt file | |
3. **Analyze**: Click "Analyze Text" to get results | |
4. **Results**: View detected aspects and their sentiments with color-coded labels | |
## Example | |
**Input:** "The food was excellent but the service was terrible." | |
**Output:** | |
- Aspect: "food" β Sentiment: positive (green) | |
- Aspect: "service" β Sentiment: negative (red) | |
## API Endpoints | |
- `GET /` - Web interface | |
- `POST /analyze` - Analyze text (JSON API) | |
- `GET /health` - Health check | |
## Technology Stack | |
- **Backend**: FastAPI + SetFit models | |
- **Frontend**: React + TailwindCSS (inline) | |
- **Models**: SetFit with sentence-transformers/all-MiniLM-L6-v2 | |
- **Deployment**: Docker on Hugging Face Spaces | |
## Citation | |
```bibtex | |
@article{https://doi.org/10.48550/arxiv.2209.11055, | |
doi = {10.48550/ARXIV.2209.11055}, | |
url = {https://arxiv.org/abs/2209.11055}, | |
author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren}, | |
title = {Efficient Few-Shot Learning Without Prompts}, | |
publisher = {arXiv}, | |
year = {2022}, | |
} | |
``` |