🚀 Launched SafeGuard AI: A BERT-powered app to detect online toxicity


:rocket: Launched SafeGuard AI: A BERT-powered app to detect online toxicity

Hey everyone,

I’m excited to share a project I’ve been working on called SafeGuard AI. It’s a web app built with Streamlit that uses a fine-tuned BERT model to detect cyberbullying and toxic comments in real time. The goal is to create a simple tool that can help promote safer online spaces.

You can try the live demo here: https://safegaurd-ai.streamlit.app/

What it Does

You can enter any sentence or comment into the app, and it will classify it as either “Bullying” or “Not Bullying” with a confidence score. It’s designed to understand the context and nuance of language, not just keywords.


Tech Stack :hammer_and_wrench:

  • UI: Streamlit
  • Machine Learning: PyTorch
  • Model Framework: Hugging Face Transformers
  • Data Handling: Pandas

How it Works & Performance

The core of the app is a bert-base-uncased model that was fine-tuned on a balanced dataset of over 115,000 text samples.

After training, the model achieved some really strong results on the test set:

  • Accuracy: 93%
  • Recall (for Bullying): 96% (meaning it successfully catches 96% of harmful comments)
  • F1-Score: 0.93

This high recall shows it’s very effective at its main job of identifying toxic content.


How You Can Recreate It

For anyone interested in how this was built, the whole process is documented in the GitHub repository. The basic steps were:

  1. Data Preparation: Combined several public datasets and created a large, balanced .csv file.
  2. Model Training: Fine-tuned the BERT model on the prepared data using PyTorch in a Google Colab notebook.
  3. App Development: Created the app.py script using Streamlit to build the interface and load the saved model files.
  4. Deployment: Pushed the entire project (app script, model files via Git LFS, and requirements) to GitHub and deployed it on Streamlit Cloud.

You can find the full code, the final model, and a detailed README here: GitHub - Dipanshu7777/bullying-detector: Cyberbullying Detection App using BERT NLP and Streamlit

I’m really passionate about using AI for social good and would love to hear any feedback or suggestions from the community. Thanks for checking it out!