Prajwalsp25 commited on
Commit
fb0562c
·
verified ·
1 Parent(s): 5f52595

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load Fake News Detection model
5
+ pipe = pipeline("text-classification", model="Pulk17/Fake-News-Detection")
6
+
7
+ def detect_fake_news(text):
8
+ results = pipe(text)
9
+ # Convert to dictionary {label: score}
10
+ scores = {r["label"]: r["score"] for r in results}
11
+ return scores
12
+
13
+ demo = gr.Interface(
14
+ fn=detect_fake_news,
15
+ inputs=gr.Textbox(lines=4, placeholder="Paste news article, headline, or social media post..."),
16
+ outputs=gr.Label(num_top_classes=2),
17
+ title="📰 Fake News Detector",
18
+ description="Enter a news article or post and see if it's REAL or FAKE with confidence scores."
19
+ )
20
+
21
+ demo.launch()