# app.py import gradio as gr import joblib # Load trained model model = joblib.load("spam_classifier.pkl") # Prediction function def classify_email(email_text): prediction = model.predict([email_text])[0] return "Spam 🚨" if prediction == 1 else "Not Spam ✅" # Create Gradio Interface iface = gr.Interface( fn=classify_email, inputs=gr.Textbox(lines=5, placeholder="Enter email content here..."), outputs="text", title="📧 Email Spam Classifier", description="This model uses a TF-IDF + Logistic Regression to classify SMS/email messages as Spam or Not Spam." ) # Launch the app iface.launch()