# app.py import streamlit as st from model import predict_text st.set_page_config( page_title="AI Cyber Threat Detector", page_icon="🛡️", layout="centered" ) st.title("🛡️ AI Cyber Threat Detector") st.write("Detect phishing, spam, or suspicious messages using AI.") # Input box text = st.text_input( "Enter URL or message", placeholder="Example: http://secure-paypal-login.xyz" ) # Button if st.button("Analyze"): if text.strip() == "": st.warning("Please enter a message or URL.") else: with st.spinner("Analyzing..."): result = predict_text(text) label = result["prediction"] confidence = result["confidence"] # Display result if label.lower() in ["spam", "phishing", "malicious"]: st.error(f"⚠️ Threat Detected: {label}") else: st.success(f"✅ Safe: {label}") st.write("Confidence:", confidence, "%") # Footer st.markdown("---") st.caption("Built with Hugging Face Transformers")