File size: 633 Bytes
082e05a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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()