import streamlit as st import joblib from textcleaning import clean_documents import pandas as pd model = joblib.load("model.pkl") st.set_page_config( page_title="Cyberbullying Detection", page_icon="🛡️", layout="centered" ) st.markdown( """

🛡️Cyberbullying Detection & Classification System

Enter a social media message below to detect whether it contains cyberbullying.


""", unsafe_allow_html=True, ) user_text = st.text_area( "✍️ Enter Text", placeholder="Type or paste a message here...", height=180 ) col1, col2 = st.columns([1, 1]) with col1: predict = st.button("🔍 Predict", use_container_width=True) with col2: clear = st.button("🗑️ Clear Output", use_container_width=True) if clear: st.rerun() if predict: if user_text.strip(): user_series = pd.Series([user_text]) with st.spinner("Analyzing text..."): prediction = model.predict(user_series)[0] st.markdown("---") st.subheader("📊 Prediction Result") if prediction == "not_cyberbullying": st.success(f"✅ **Prediction:** {prediction}") else: st.error(f"🚨 **Prediction:** {prediction}") else: st.warning("⚠️ Please enter some text before clicking Predict.") st.markdown("---") st.caption("Developed using Streamlit | Scikit-learn | NLP | TF-IDF | Logistic Regression")