MuntasirHossain commited on
Commit
eb0c047
·
1 Parent(s): bd7512d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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 predict(prompt):
10
- completion = model(prompt)[0]["label"]
11
- return completion
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=predict,
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,