Spaces:
Sleeping
Sleeping
File size: 684 Bytes
01f9626 d64b230 01f9626 d64b230 01f9626 d64b230 01f9626 d64b230 |
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 |
import gradio as gr
from transformers import pipeline
# Charger le modèle existant depuis Hugging Face
classifier = pipeline("text-classification", model="IreNkweke/HamOrSpamModel")
def predict_spam(text):
result = classifier(text)[0]
label = result['label'] # 'LABEL_0' ou 'LABEL_1'
if label in ['LABEL_0', 'Ham']:
return "Ham (Not Spam)"
else:
return "Spam"
# Interface Gradio
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()
|