| import gradio as gr |
| from transformers import pipeline |
|
|
| |
| classifier = pipeline("text-classification", model="IreNkweke/HamOrSpamModel") |
|
|
| def predict_spam(text): |
| result = classifier(text)[0] |
| label = result['label'] |
| if label in ['LABEL_0', 'Ham']: |
| return "Ham (Not Spam)" |
| else: |
| return "Spam" |
|
|
| |
| iface = gr.Interface( |
| fn=predict_spam, |
| inputs=gr.Textbox(lines=4, placeholder="Enter your message here..."), |
| outputs="text", |
| title="Spam/Ham Classifier", |
| description="Classifier messages as Spam or Ham using a pre-trained model." |
| ) |
|
|
| iface.launch() |
|
|