🛡️ About the Project – SafeTweet: AI Bot Against Cyberbullying & Hate Speech 💡 Inspiration In the age of social media, platforms like Twitter/X are flooded with cyberbullying, hate speech, and misinformation. This creates a toxic environment—especially harmful to youth and marginalized communities. We were inspired to build a tool that promotes digital well-being and positive online interaction.
That’s how SafeTweet was born: A bot that automatically detects harmful tweets, finds factual help using RAG (Retrieval-Augmented Generation), and responds kindly to foster healthier conversations.
🛠️ How We Built It We developed the project using an open-source and transparent ML pipeline:
Frontend: Streamlit app, deployed via Hugging Face Spaces
Backend: Python Flask backend (lightweight & interpretable)
ML Model: Custom-trained scikit-learn text classification model
RAG System: Semantic search using FAISS to retrieve guidance/resources
LLM (via Groq): Quantized open-source Mistral model for response generation
Twitter API: Automatically reads & replies to tweets when in bot mode
python Copy Edit
Example: Toxic Tweet Detection
prediction = model.predict(["You are worthless and nobody cares about you."]) print(prediction) # ['toxic'] 🧠 What We Learned Training a text classifier with annotated datasets (non-black-box)
Semantic vector search using FAISS
Deployment via Hugging Face + Streamlit UI customization
Secure integration of the Twitter/X API
Fine-tuning prompt engineering for Groq-hosted LLMs
🚧 Challenges We Faced Collecting high-quality non-LLM datasets for toxic tweet training
Keeping the app responsive on a free-tier deployment
Balancing accuracy with interpretability
Creating respectful auto-responses without sounding robotic
Avoiding false positives and unintended censorship
📌 Summary SafeTweet is an open-source, fully-transparent AI bot that flags harmful tweets and responds with empathetic, fact-based, and resourceful replies.
Built With
- faiss
- flask
- generation)
- groq
- python
- retrieval-augmented
- scikit-learn
- streamlit
Log in or sign up for Devpost to join the conversation.