Spaces:
Sleeping
Sleeping
File size: 974 Bytes
e23b8f4 834e6c3 e23b8f4 834e6c3 e23b8f4 834e6c3 e23b8f4 834e6c3 e23b8f4 c2d6113 e23b8f4 bf7fdad 32f76e7 e23b8f4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import gradio as gr
from transformers import pipeline
CLASSIFIER_MODEL_ID = "sks01dev/clickbait-classifier"
classifier = pipeline(
"sentiment-analysis",
model=CLASSIFIER_MODEL_ID,
tokenizer=CLASSIFIER_MODEL_ID,
return_all_scores=True
)
def predict(headline):
results = classifier(headline)[0]
formatted_output = {
"NOT CLICKBAIT (0)": results[0]['score'],
"CLICKBAIT (1)": results[1]['score']
}
return formatted_output
# Gradio Interface Setup
gr.Interface(
fn=predict,
inputs=gr.Textbox(lines=2, label="Enter News Headline"),
outputs=gr.Label(num_top_classes=2),
title="World-Class Clickbait Predictor",
description="DeBERTa-v3-small model deployed for high-confidence headline analysis.",
examples=[
["10 Ways To Instantly Improve Your Mood"],
["You Won't Believe What Happened When We Tested This!"],
["Government Releases New Economic Policy Report"],
]
).launch()
|