Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
| 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,
|
| 86 |
response = pipe(text)
|
| 87 |
-
return
|
| 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",
|