import streamlit as st import pandas as pd from utils import predict_toxicity st.set_page_config( page_title="ToxiGuard AI", page_icon="🛡️", layout="centered" ) # LOAD CSS with open("style.css") as f: st.markdown( f"", unsafe_allow_html=True ) # TITLE st.title("🛡️ ToxiGuard AI") st.subheader( "Advanced Multi-label Toxic Comment Detection using BERT" ) st.markdown("---") # TEXT INPUT user_input = st.text_area( "Enter a comment", height=180, placeholder="Type comment here..." ) # BUTTON if st.button("Analyze Toxicity"): if user_input.strip() == "": st.warning( "Please enter a comment." ) else: results = predict_toxicity( user_input ) st.markdown("## Detection Results") toxicity_detected = False for label, score in results.items(): st.progress(score) st.write( f"### {label}: {score:.4f}" ) if score >= 0.5: toxicity_detected = True st.markdown("---") if toxicity_detected: st.error( " Toxic content detected." ) else: st.success( " Comment appears safe." )