Spaces:
Sleeping
Sleeping
File size: 950 Bytes
b452481 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 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()
|