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.
cardiffnlp/twitter-roberta-base-offensiveReact Frontend (Vite + TS)
│
▼
Flask API (/analyze)
│
├──► Groq LLM (context expansion)
│
└──► HuggingFace Classifier
│
▼
Offensive / Non-Offensive Result
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
python -m venv .venv
# Windows PowerShell
.\.venv\Scripts\Activate.ps1
# or CMD
.\.venv\Scripts\activate.bat
pip install flask flask-cors transformers torch groq
⚠️ 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.
cd ML
python server.py
Server runs at:
http://localhost:5000
POST /analyze
{
"context": "Meeting notes",
"message": "You are completely useless"
}
curl -X POST http://localhost:5000/analyze -H "Content-Type: application/json" -d '{"context":"Meeting notes","message":"You are completely useless"}'
{
"label": "offensive",
"confidence": 0.87
}
This project is intended for educational and experimental purposes.
5 commits
HTML
86.4%
Python
11.2%
JavaScript
1.4%
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.
cardiffnlp/twitter-roberta-base-offensiveReact Frontend (Vite + TS)
│
▼
Flask API (/analyze)
│
├──► Groq LLM (context expansion)
│
└──► HuggingFace Classifier
│
▼
Offensive / Non-Offensive Result
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
python -m venv .venv
# Windows PowerShell
.\.venv\Scripts\Activate.ps1
# or CMD
.\.venv\Scripts\activate.bat
pip install flask flask-cors transformers torch groq
⚠️ 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.
cd ML
python server.py
Server runs at:
http://localhost:5000
POST /analyze
{
"context": "Meeting notes",
"message": "You are completely useless"
}
curl -X POST http://localhost:5000/analyze -H "Content-Type: application/json" -d '{"context":"Meeting notes","message":"You are completely useless"}'
{
"label": "offensive",
"confidence": 0.87
}
This project is intended for educational and experimental purposes.
5 commits
HTML
86.4%
Python
11.2%
JavaScript
1.4%