anshul-rohilla4 commited on
Commit
082e05a
·
1 Parent(s): 7bdb511

Add application file

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+
3
+ import gradio as gr
4
+ import joblib
5
+
6
+ # Load trained model
7
+ model = joblib.load("spam_classifier.pkl")
8
+
9
+ # Prediction function
10
+ def classify_email(email_text):
11
+ prediction = model.predict([email_text])[0]
12
+ return "Spam 🚨" if prediction == 1 else "Not Spam ✅"
13
+
14
+ # Create Gradio Interface
15
+ iface = gr.Interface(
16
+ fn=classify_email,
17
+ inputs=gr.Textbox(lines=5, placeholder="Enter email content here..."),
18
+ outputs="text",
19
+ title="📧 Email Spam Classifier",
20
+ description="This model uses a TF-IDF + Logistic Regression to classify SMS/email messages as Spam or Not Spam."
21
+ )
22
+
23
+ # Launch the app
24
+ iface.launch()