nickprock commited on
Commit
be17526
·
1 Parent(s): b350fa5

create app.py

Browse files
Files changed (1) hide show
  1. app.py +97 -0
app.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
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',
10
+ 'LABEL_4':'automatic_top_up',
11
+ 'LABEL_5':'balance_not_updated_after_bank_transfer',
12
+ 'LABEL_6':'balance_not_updated_after_cheque_or_cash_deposit',
13
+ 'LABEL_7':'beneficiary_not_allowed',
14
+ 'LABEL_8':'cancel_transfer',
15
+ 'LABEL_9':'card_about_to_expire',
16
+ 'LABEL_10':'card_acceptance',
17
+ 'LABEL_11':'card_arrival',
18
+ 'LABEL_12':'card_delivery_estimate',
19
+ 'LABEL_13':'card_linking',
20
+ 'LABEL_14':'card_not_working',
21
+ 'LABEL_15':'card_payment_fee_charged',
22
+ 'LABEL_16':'card_payment_not_recognised',
23
+ 'LABEL_17':'card_payment_wrong_exchange_rate',
24
+ 'LABEL_18':'card_swallowed',
25
+ 'LABEL_19':'cash_withdrawal_charge',
26
+ 'LABEL_20':'cash_withdrawal_not_recognised',
27
+ 'LABEL_21':'change_pin',
28
+ 'LABEL_22':'compromised_card',
29
+ 'LABEL_23':'contactless_not_working',
30
+ 'LABEL_24':'country_support',
31
+ 'LABEL_25':'declined_card_payment',
32
+ 'LABEL_26':'declined_cash_withdrawal',
33
+ 'LABEL_27':'declined_transfer',
34
+ 'LABEL_28':'direct_debit_payment_not_recognised',
35
+ 'LABEL_29':'disposable_card_limits',
36
+ 'LABEL_30':'edit_personal_details',
37
+ 'LABEL_31':'exchange_charge',
38
+ 'LABEL_32':'exchange_rate',
39
+ 'LABEL_33':'exchange_via_app',
40
+ 'LABEL_34':'extra_charge_on_statement',
41
+ 'LABEL_35':'failed_transfer',
42
+ 'LABEL_36':'fiat_currency_support',
43
+ 'LABEL_37':'get_disposable_virtual_card',
44
+ 'LABEL_38':'get_physical_card',
45
+ 'LABEL_39':'getting_spare_card',
46
+ 'LABEL_40':'getting_virtual_card',
47
+ 'LABEL_41':'lost_or_stolen_card',
48
+ 'LABEL_42':'lost_or_stolen_phone',
49
+ 'LABEL_43':'order_physical_card',
50
+ 'LABEL_44':'passcode_forgotten',
51
+ 'LABEL_45':'pending_card_payment',
52
+ 'LABEL_46':'pending_cash_withdrawal',
53
+ 'LABEL_47':'pending_top_up',
54
+ 'LABEL_48':'pending_transfer',
55
+ 'LABEL_49':'pin_blocked',
56
+ 'LABEL_50':'receiving_money',
57
+ 'LABEL_51':'Refund_not_showing_up',
58
+ 'LABEL_52':'request_refund',
59
+ 'LABEL_53':'reverted_card_payment?',
60
+ 'LABEL_54':'supported_cards_and_currencies',
61
+ 'LABEL_55':'terminate_account',
62
+ 'LABEL_56':'top_up_by_bank_transfer_charge',
63
+ 'LABEL_57':'top_up_by_card_charge',
64
+ 'LABEL_58':'top_up_by_cash_or_cheque',
65
+ 'LABEL_59':'top_up_failed',
66
+ 'LABEL_60':'top_up_limits',
67
+ 'LABEL_61':'top_up_reverted',
68
+ 'LABEL_62':'topping_up_by_card',
69
+ 'LABEL_63':'transaction_charged_twice',
70
+ 'LABEL_64':'transfer_fee_charged',
71
+ 'LABEL_65':'transfer_into_account',
72
+ 'LABEL_66':'transfer_not_received_by_recipient',
73
+ 'LABEL_67':'transfer_timing',
74
+ 'LABEL_68':'unable_to_verify_identity',
75
+ 'LABEL_69':'verify_my_identity',
76
+ 'LABEL_70':'verify_source_of_funds',
77
+ 'LABEL_71':'verify_top_up',
78
+ 'LABEL_72':'virtual_card_not_working',
79
+ 'LABEL_73':'visa_or_mastercard',
80
+ 'LABEL_74':'why_verify_identity',
81
+ 'LABEL_75':'wrong_amount_of_cash_received',
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",
91
+ outputs="text",
92
+ title="Banking Intent Classifier",
93
+ description="Try to classify customer queries",
94
+ examples=[["I can't pay by my credit card"],["Do you have a list of exchange rates?"],["Can I track the card you sent to me?"]],
95
+ cache_examples=False)
96
+
97
+ demo.launch()