File size: 761 Bytes
4cf4a9e ab6f576 4cf4a9e 00f5eca 4cf4a9e eb0c047 4cf4a9e daabffc 35a2d2e 4cf4a9e bd7512d 4cf4a9e eb0c047 4cf4a9e 561d441 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from transformers import pipeline
import gradio as gr
model_checkpoint = "MuntasirHossain/distilbert-finetuned-ag-news"
model = pipeline("text-classification", model=model_checkpoint)
def classify(text):
label = model(text)[0]["label"]
return label
description = "This AI model is trained to classify texts/articles/sentences into four categories: World, Sports, Business and Science/Tech."
title = "Classify Your Texts"
theme = "peach"
examples=[["Global Retail Giants Gear Up for Record-Breaking Holiday Sales Season Amidst Supply Chain Challenges and Rising Consumer Demand."]]
gr.Interface(fn=classify,
inputs="textbox",
outputs="text",
title=title,
theme = theme,
description=description,
examples=examples,
).launch() |