Commit
·
eb0c047
1
Parent(s):
bd7512d
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,16 +6,16 @@ model_checkpoint = "MuntasirHossain/distilbert-finetuned-ag-news"
|
|
| 6 |
model = pipeline("text-classification", model=model_checkpoint)
|
| 7 |
|
| 8 |
|
| 9 |
-
def
|
| 10 |
-
|
| 11 |
-
return
|
| 12 |
|
| 13 |
description = "This AI model is trained to classify news articles into four categories: World, Sports, Business and Science/Tech."
|
| 14 |
title = "Classify Your Articles"
|
| 15 |
theme = "peach"
|
| 16 |
examples=[["Global Retail Giants Gear Up for Record-Breaking Holiday Sales Season Amidst Supply Chain Challenges and Rising Consumer Demand."]]
|
| 17 |
|
| 18 |
-
gr.Interface(fn=
|
| 19 |
inputs="textbox",
|
| 20 |
outputs="text",
|
| 21 |
title=title,
|
|
|
|
| 6 |
model = pipeline("text-classification", model=model_checkpoint)
|
| 7 |
|
| 8 |
|
| 9 |
+
def classify(text):
|
| 10 |
+
label = model(text)[0]["label"]
|
| 11 |
+
return label
|
| 12 |
|
| 13 |
description = "This AI model is trained to classify news articles into four categories: World, Sports, Business and Science/Tech."
|
| 14 |
title = "Classify Your Articles"
|
| 15 |
theme = "peach"
|
| 16 |
examples=[["Global Retail Giants Gear Up for Record-Breaking Holiday Sales Season Amidst Supply Chain Challenges and Rising Consumer Demand."]]
|
| 17 |
|
| 18 |
+
gr.Interface(fn=classify,
|
| 19 |
inputs="textbox",
|
| 20 |
outputs="text",
|
| 21 |
title=title,
|