Detection_spam / app.py
Iralion's picture
Create app.py
7516f49 verified
import gradio as gr
import pandas as pd
import joblib
model = joblib.load("svm.joblib")
vectorizer = joblib.load("vectorizer.joblib")
encoder = joblib.load("encoder.joblib")
# --- Fonction de prédiction ---
def detect_spam(message):
vect = vectorizer.transform([message])
pred = model.predict(vect)[0]
return "🚫 SPAM" if pred == 1 else "✅ PAS SPAM"
# --- Interface Gradio ---
interface = gr.Interface(
fn=detect_spam,
inputs=gr.Textbox(lines=4, placeholder="Entrez un message SMS ici..."),
outputs="text",
title="📩 Détection de Spam par SVM",
description="Entrez un message pour savoir s'il est classé comme spam ou non."
)
interface.launch()