Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# scam_checker_app.py
|
2 |
+
|
3 |
+
import gradio as gr
|
4 |
+
from transformers import pipeline
|
5 |
+
|
6 |
+
# Load pre-trained model (you can later fine-tune your own)
|
7 |
+
classifier = pipeline("text-classification", model="mrm8488/bert-tiny-finetuned-fake-news-detection")
|
8 |
+
|
9 |
+
def check_scam(message):
|
10 |
+
result = classifier(message)[0]
|
11 |
+
label = result['label']
|
12 |
+
|
13 |
+
if label == "FAKE":
|
14 |
+
verdict = "⚠️ This message is likely a SCAM or FAKE"
|
15 |
+
elif label == "REAL":
|
16 |
+
verdict = "✅ This message seems SAFE"
|
17 |
+
else:
|
18 |
+
verdict = "❓ Unable to determine"
|
19 |
+
|
20 |
+
return verdict
|
21 |
+
|
22 |
+
# Gradio Interface
|
23 |
+
demo = gr.Interface(
|
24 |
+
fn=check_scam,
|
25 |
+
inputs=gr.Textbox(lines=6, placeholder="Paste suspicious message or email here..."),
|
26 |
+
outputs="text",
|
27 |
+
title="🔍 Scam & Spam Message Checker",
|
28 |
+
description="Paste any message or email to check if it's likely to be a scam or fake using AI.",
|
29 |
+
)
|
30 |
+
|
31 |
+
demo.launch()
|