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()