Get Appointment

Sentiment Analysis Tool

Real-Time Sentiment Analysis with FastAPI and VADE

W A lightweight, fast, and accurate Sentiment Analysis Web App built with FastAPI and VADER NLP. This tool classifies user input into Positive, Negative, or Neutral sentiment using real-time analysis.

Category
Web App
Source Code
View
Published
Aug. 14, 2025

Project Summery

A lightweight, fast, and accurate Sentiment Analysis Web App built with FastAPI and VADER NLP. This tool classifies user input into PositiveNegative, or Neutral sentiment using real-time analysis.


🚀 Features

  • ✅ Fast sentiment prediction using VADER (NLTK)
  • 🌐 REST API with /api/sentiment endpoint
  • 🖥️ Web UI built with Jinja2 templates
  • 📥 Supports both API and HTML form submission
  • 🐳 Docker-ready for containerized deployment

📦 Tech Stack

  • Python 3.10+
  • FastAPI
  • NLTK (VADER Lexicon)
  • Jinja2 Templates
  • HTML / CSS (Basic)
  • Uvicorn (for ASGI server)

🏗️ Folder Structure

  • sentiment_analyzer/
    • app/
      • __init__.py – Marks this folder as a Python package
      • main.py – FastAPI app logic
      • sentiment.py – Sentiment analysis logic
      • schemas.py – Request/response models
      • templates/
        • index.html – Web frontend (Jinja2 template)
    • requirements.txt – List of dependencies
    • README.md – Project documentation

⚙️ Installation

 

1. Clone the repository

git clone https://github.com/sujit-codezen/sentiment_analyzer.git
cd sentiment-analyzer

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

pip install -r requirements.txt


uvicorn app.main:app --reload

 

Sample API Request

curl -X POST http://localhost:8000/api/sentiment \
-H "Content-Type: application/json" \
-d '{"text": "I love FastAPI, it is amazing!"}'

{
  "label": "Positive",
  "scores": {
    "neg": 0.0,
    "neu": 0.431,
    "pos": 0.569,
    "compound": 0.6486
  }
}

Share