Skip to content

About

Production-grade Sentiment Analysis API featuring a Dual-Model Architecture. Implements a high-speed TF-IDF + Logistic Regression baseline and a fine-tuned DistilBERT Transformer. Built with FastAPI, containerized with Docker, and protected by a CI/CD test suite.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

SentiGrade: Production-Grade Sentiment Analysis API

Python FastAPI Docker CI/CD

Project Overview

SentiGrade is a scalable microservice for sentiment classification (Positive, Negative, Neutral). It implements a Dual-Model Architecture allowing runtime switching between:

  1. Baseline: TF-IDF + Logistic Regression (Low Latency).
  2. SOTA: DistilBERT Transformer (High Accuracy).

Quick Start (Docker)

1. Clone & Setup

# Clone the repository
git clone https://github.com/Eatosin/SentiGrade.git
cd SentiGrade

# Install dependencies
pip install -r requirements.txt

2. Run the API (Local)

# Start the FastAPI server
python src/main.py

Access documentation at http://localhost:8000/docs

3. Run with Docker

# Build and launch the container
docker-compose up --build

Model performance

1. Baseline: Logistic Regression

  • Accuracy: 59%
  • F1-Score: 0.58
  • Status: Included in repo.

2. SOTA: DistilBERT (Fine-Tuned)

  • Accuracy: 69.5%
  • F1-Score: 0.70
  • Status: Available via external download (see models/DOWNLOAD_INSTRUCTIONS.md).

Testing & Quality Assurance

I have implemented a comprehensive test suite using Pytest and FastAPI TestClient. The tests include mocking of the transformer models to allow for rapid CI/CD execution without heavy hardware.

Run the tests:

python -m pytest tests/ -v

Quality Standards:

  • Type Safety: 100% Type Hinting coverage (Checked via MyPy).
  • Logging: Production-grade structured logging for request traceability.
  • Validation: Pydantic models for all Request/Response payloads

Author

Owadokun Tosin Tobi Senior AI Engineer

About

Production-grade Sentiment Analysis API featuring a Dual-Model Architecture. Implements a high-speed TF-IDF + Logistic Regression baseline and a fine-tuned DistilBERT Transformer. Built with FastAPI, containerized with Docker, and protected by a CI/CD test suite.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages