DemoSetfit / README.md
thanhtoan034's picture
Deploy with original FastAPI UI
58eae37
metadata
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 - Aspect extraction (86.1% accuracy)
  2. 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

@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},
}