Santosh7131/TalkSense

Lightweight Offensive Content Detection Demo TalkSense is a minimal full-stack demo that shows how a React frontend can communicate with a Python ML microservice to detect offensive language in text using modern NLP models.

0

stars

5

commits

HTML

primary language

Dec 21, 2025

updated

README

🗣️ TalkSense

Lightweight Offensive Content Detection Demo

TalkSense is a minimal full-stack demo that shows how a React frontend can communicate with a Python ML microservice to detect offensive language in text using modern NLP models.


✨ Highlights

  • ⚛️ React + Vite frontend (TypeScript + Tailwind CSS)
  • 🧠 Python ML service using HuggingFace Transformers
  • 🚀 Flask REST API for text analysis
  • 🤖 Context expansion using Groq LLM
  • 🔍 Offensive content classification with
    cardiffnlp/twitter-roberta-base-offensive

🧩 Architecture

React Frontend (Vite + TS)
        │
        ▼
Flask API (/analyze)
        │
        ├──► Groq LLM (context expansion)
        │
        └──► HuggingFace Classifier
                    │
                    ▼
        Offensive / Non-Offensive Result

📁 Repository Structure

TalkSense/
│
├── project/                 # Frontend (React + Vite)
│   ├── src/
│   │   ├── App.tsx
│   │   ├── main.tsx
│   │   └── index.css
│   └── package.json
│
├── ML/                      # Python ML Service
│   ├── two_nlp.py           # NLP pipeline (Groq + HF model)
│   ├── server.py            # Flask API server
│   └── main.py              # Groq demo script
│
└── README.md

🛠️ Tech Stack

Frontend

  • React
  • Vite
  • TypeScript
  • Tailwind CSS

Backend / ML

  • Python
  • Flask + Flask-CORS
  • HuggingFace Transformers
  • PyTorch
  • Groq API

🚀 Setup & Run

1️⃣ Python ML Service

Create a virtual environment and install dependencies

python -m venv .venv

# Windows PowerShell
.\.venv\Scripts\Activate.ps1

# or CMD
.\.venv\Scripts\activate.bat

pip install flask flask-cors transformers torch groq

🔐 Environment Variable (Important)

⚠️ Do NOT hard-code API keys

Set your Groq API key using an environment variable:

setx GROQ_API_KEY "your_real_key_here"

Restart the terminal after running setx.


▶️ Start the Flask Server

cd ML
python server.py

Server runs at:

http://localhost:5000

📡 API Reference

Endpoint

POST /analyze

Request Body

{
  "context": "Meeting notes",
  "message": "You are completely useless"
}

Example Request

curl -X POST http://localhost:5000/analyze   -H "Content-Type: application/json"   -d '{"context":"Meeting notes","message":"You are completely useless"}'

Example Response

{
  "label": "offensive",
  "confidence": 0.87
}

🧪 Project Scope

✅ This project demonstrates

  • ML + frontend integration
  • Clean REST-based architecture
  • NLP experimentation using real models

❌ This project does not aim to be

  • Production-ready moderation software
  • Highly optimized or scalable
  • A full enterprise content-filtering solution

🔮 Possible Enhancements

  • Dockerization
  • Authentication & rate limiting
  • Model caching for faster inference
  • Streaming responses
  • Frontend confidence visualization

📜 License

This project is intended for educational and experimental purposes.

Contributors

Santosh7131

5 commits

Santosh7131/TalkSense

Lightweight Offensive Content Detection Demo TalkSense is a minimal full-stack demo that shows how a React frontend can communicate with a Python ML microservice to detect offensive language in text using modern NLP models.

0

stars

5

commits

HTML

primary language

Dec 21, 2025

updated

README

🗣️ TalkSense

Lightweight Offensive Content Detection Demo

TalkSense is a minimal full-stack demo that shows how a React frontend can communicate with a Python ML microservice to detect offensive language in text using modern NLP models.


✨ Highlights

  • ⚛️ React + Vite frontend (TypeScript + Tailwind CSS)
  • 🧠 Python ML service using HuggingFace Transformers
  • 🚀 Flask REST API for text analysis
  • 🤖 Context expansion using Groq LLM
  • 🔍 Offensive content classification with
    cardiffnlp/twitter-roberta-base-offensive

🧩 Architecture

React Frontend (Vite + TS)
        │
        ▼
Flask API (/analyze)
        │
        ├──► Groq LLM (context expansion)
        │
        └──► HuggingFace Classifier
                    │
                    ▼
        Offensive / Non-Offensive Result

📁 Repository Structure

TalkSense/
│
├── project/                 # Frontend (React + Vite)
│   ├── src/
│   │   ├── App.tsx
│   │   ├── main.tsx
│   │   └── index.css
│   └── package.json
│
├── ML/                      # Python ML Service
│   ├── two_nlp.py           # NLP pipeline (Groq + HF model)
│   ├── server.py            # Flask API server
│   └── main.py              # Groq demo script
│
└── README.md

🛠️ Tech Stack

Frontend

  • React
  • Vite
  • TypeScript
  • Tailwind CSS

Backend / ML

  • Python
  • Flask + Flask-CORS
  • HuggingFace Transformers
  • PyTorch
  • Groq API

🚀 Setup & Run

1️⃣ Python ML Service

Create a virtual environment and install dependencies

python -m venv .venv

# Windows PowerShell
.\.venv\Scripts\Activate.ps1

# or CMD
.\.venv\Scripts\activate.bat

pip install flask flask-cors transformers torch groq

🔐 Environment Variable (Important)

⚠️ Do NOT hard-code API keys

Set your Groq API key using an environment variable:

setx GROQ_API_KEY "your_real_key_here"

Restart the terminal after running setx.


▶️ Start the Flask Server

cd ML
python server.py

Server runs at:

http://localhost:5000

📡 API Reference

Endpoint

POST /analyze

Request Body

{
  "context": "Meeting notes",
  "message": "You are completely useless"
}

Example Request

curl -X POST http://localhost:5000/analyze   -H "Content-Type: application/json"   -d '{"context":"Meeting notes","message":"You are completely useless"}'

Example Response

{
  "label": "offensive",
  "confidence": 0.87
}

🧪 Project Scope

✅ This project demonstrates

  • ML + frontend integration
  • Clean REST-based architecture
  • NLP experimentation using real models

❌ This project does not aim to be

  • Production-ready moderation software
  • Highly optimized or scalable
  • A full enterprise content-filtering solution

🔮 Possible Enhancements

  • Dockerization
  • Authentication & rate limiting
  • Model caching for faster inference
  • Streaming responses
  • Frontend confidence visualization

📜 License

This project is intended for educational and experimental purposes.

Contributors

Santosh7131

5 commits

Languages

HTML

86.4%

Python

11.2%

JavaScript

1.4%