cppeClassModel1 / app.py
anshul-rohilla4
Add application file
082e05a
raw
history blame contribute delete
633 Bytes
# 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()