import gradio as gr from transformers import pipeline # Load a sentiment model that can classify scam-like language classifier = pipeline("text-classification", model="bhadresh-savani/bert-base-uncased-emotion") def detect_scam(text): result = classifier(text)[0] label = result['label'] score = result['score'] if "fear" in label.lower() or "anger" in label.lower(): message = "⚠️ This message may be a scam or manipulative." else: message = "✅ This message seems okay." return f"Prediction: {label} ({score:.2f})\n{message}" interface = gr.Interface(fn=detect_scam, inputs=gr.Textbox(lines=4, placeholder="Paste a message here..."), outputs="text", title="SafeNet AI - Scam Message Detector", description="Paste a suspicious message to detect if it might be a scam using AI.") interface.launch()