File size: 610 Bytes
af84838
 
 
aad8494
af84838
 
aad8494
 
 
 
 
 
 
 
 
 
 
 
 
dd38050
aad8494
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
from transformers import pipeline

model = pipeline("text-classification", model="distilbert-base-uncased-finetuned-sst-2-english")

def detect_fake_news(text):
    result = model(text)[0]
    label = result['label']
    
    if label == "NEGATIVE":
        return "❌ Fake News"
    else:
        return "βœ… Real News"

interface = gr.Interface(
    fn=detect_fake_news,
    inputs=gr.Textbox(lines=7, placeholder="Enter news text here..."),
    outputs="text",
    title="Fake News Detector",
    description="A simple model to classify text as fake or real news."
)

interface.launch()