spam-mail / app.py
gaurav5005's picture
Update app.py
9159568 verified
raw
history blame contribute delete
690 Bytes
import gradio as gr
import pickle
# Load trained model and vectorizer
model = pickle.load(open("spam_mail_model.pkl", "rb"))
vectorizer = pickle.load(open("vectorizer.pkl", "rb"))
# Prediction function
def predict_mail(text):
input_data = vectorizer.transform([text])
prediction = model.predict(input_data)[0]
return "βœ… Ham Mail" if prediction == 1 else "🚫 Spam Mail"
# Gradio interface
demo = gr.Interface(
fn=predict_mail,
inputs=gr.Textbox(lines=3, placeholder="Enter your email text here..."),
outputs="text",
title="πŸ“§ Spam Mail Classifier",
description="Detect if an email is Spam 🚫 or Ham βœ… using Logistic Regression."
)
demo.launch()