File size: 597 Bytes
4847078
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b08664b
4847078
 
 
1eb64c7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#%%writefile app.py
from transformers import pipeline
import gradio as gr


# Load Hugging Face spam classifier
classifier = pipeline("text-classification", model="kenbaker-gif/Email_Spam_Classifier")

# Prediction function
def predict_spam(text):
    result = classifier(text)[0]
    return f"Label: {result['label']}, Score: {result['score']:.2f}"

# Create Gradio interface
demo = gr.Interface(
    fn=predict_spam,
    inputs="text",
    outputs="text",
    title="Spam Classifier",
    description="Type message to see if it's spam."
)

# Launch (gives shareable link)
demo.launch(share=True)