Spam_Classifier / app.py
kenbaker-gif's picture
Update app.py
1eb64c7 verified
raw
history blame contribute delete
597 Bytes
#%%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)