praveen020 commited on
Commit
6c62ef8
·
verified ·
1 Parent(s): 2bdefe9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ model = pipeline("text-classification", model="distilbert-base-uncased-finetuned-sst-2-english")
5
+
6
+ def detect_fake_news(text):
7
+ result = model(text)[0]
8
+ label = result['label']
9
+
10
+ if label == "NEGATIVE":
11
+ return "❌ Fake News"
12
+ else:
13
+ return "✅ Real News"
14
+
15
+ interface = gr.Interface(
16
+ fn=detect_fake_news,
17
+ inputs=gr.Textbox(lines=7, placeholder="Enter news text here..."),
18
+ outputs="text",
19
+ title="Fake News Detector",
20
+ description="A simple model to classify text as fake or real news."
21
+ )
22
+
23
+ interface.launch()