nickprock commited on
Commit
51331ef
·
1 Parent(s): e1bf863

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -3,7 +3,7 @@ from transformers import pipeline
3
 
4
  pipe = pipeline("text-classification", model="nickprock/distilbert-base-uncased-banking77-classification")
5
 
6
- dic={'LABEL_0':'activate_my_card',
7
  'LABEL_1':'age_limit',
8
  'LABEL_2':'apple_pay_or_google_pay',
9
  'LABEL_3':'atm_support',
@@ -82,9 +82,9 @@ dic={'LABEL_0':'activate_my_card',
82
  'LABEL_76':'wrong_exchange_rate_for_cash_withdrawal'}
83
 
84
 
85
- def greet(text, dic = dic):
86
  response = pipe(text)
87
- return dic[response[0]['label']]
88
 
89
  demo = gr.Interface(fn=greet,
90
  inputs="text",
 
3
 
4
  pipe = pipeline("text-classification", model="nickprock/distilbert-base-uncased-banking77-classification")
5
 
6
+ dictionary={'LABEL_0':'activate_my_card',
7
  'LABEL_1':'age_limit',
8
  'LABEL_2':'apple_pay_or_google_pay',
9
  'LABEL_3':'atm_support',
 
82
  'LABEL_76':'wrong_exchange_rate_for_cash_withdrawal'}
83
 
84
 
85
+ def greet(text, dictionary=dictionary):
86
  response = pipe(text)
87
+ return dictionary[response[0]['label']]
88
 
89
  demo = gr.Interface(fn=greet,
90
  inputs="text",