This project is an end-to-end Toxic vs Non-Toxic Comment Classification System built using:
- Deep Learning (CNN / LSTM model)
- FastAPI for backend inference
- Streamlit for frontend UI
- Docker for containerized deployment
The system classifies any user comment into:
- 🟥 Toxic
- 🟩 Non-Toxic
User → Streamlit UI → FastAPI API → Toxicity Model → Prediction
- frontend/ – Streamlit user interface
- fastapp/ – FastAPI backend with model inference
- model/ – tokenizer + saved deep learning model
- docker-compose.yml – runs both apps together
Predicts:
- 0 → Non-Toxic
- 1 → Toxic
/predictendpoint- Returns prediction + confidence
- Handles tokenization, padding, inference
- Clean textbox for entering comments
- Color-coded output
- Real-time classification
- Run using
docker-compose up - Streamlit + FastAPI communicate internally
git clone <repo-url>
cd Toxic-Comment-Classifierdocker-compose up --build- 🌐 Streamlit UI: http://localhost:8501
- 🧪 FastAPI Docs (Swagger): http://localhost:8000/docs
uvicorn fastapp.main:app --reload cd frontend
streamlit run frontend/frontend.pyThis project uses a binary deep learning classifier.
- Text cleaning
- Tokenization
- Sequence padding
- Embedding layer
- CNN
- Dense layer with sigmoid output
0→ Non-Toxic1→ Toxic
{
"text": "You are so stupid!"
}{
"prediction": "Toxic",
"confidence": 0.91
}- Simple text input
- Classification result with confidence score
- User-friendly layout
- FastAPI
- Uvicorn
- TensorFlow / Keras
- Pickle
- Streamlit
- Requests
- Docker
- Docker Compose
- Add multi-label toxicity detection
- Add explanation (LIME / SHAP)