Prajwalsp25's picture
Create app.py
fb0562c verified
raw
history blame contribute delete
676 Bytes
import gradio as gr
from transformers import pipeline
# Load Fake News Detection model
pipe = pipeline("text-classification", model="Pulk17/Fake-News-Detection")
def detect_fake_news(text):
results = pipe(text)
# Convert to dictionary {label: score}
scores = {r["label"]: r["score"] for r in results}
return scores
demo = gr.Interface(
fn=detect_fake_news,
inputs=gr.Textbox(lines=4, placeholder="Paste news article, headline, or social media post..."),
outputs=gr.Label(num_top_classes=2),
title="📰 Fake News Detector",
description="Enter a news article or post and see if it's REAL or FAKE with confidence scores."
)
demo.launch()