Spaces:
Sleeping
Sleeping
vidyasharma17
commited on
Commit
•
279024a
1
Parent(s):
854d1fe
Update app.py
Browse files
app.py
CHANGED
@@ -9,12 +9,28 @@ with open("naive_bayes_model.pkl", "rb") as model_file:
|
|
9 |
with open("vectorizer.pkl", "rb") as vectorizer_file:
|
10 |
vectorizer = pickle.load(vectorizer_file)
|
11 |
|
12 |
-
# Define responses dictionary
|
13 |
responses = {
|
14 |
"activate_my_card": "To activate your card, log in to the app and navigate to the 'Activate Card' section.",
|
15 |
"age_limit": "The minimum age to use this service is 18 years.",
|
16 |
"apple_pay_or_google_pay": "Yes, you can use both Apple Pay and Google Pay with your card.",
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
|
20 |
# Define chatbot response logic
|
@@ -23,24 +39,50 @@ def chatbot_response(user_input):
|
|
23 |
predicted_label = clf.predict(vectorized_input)[0]
|
24 |
return responses.get(predicted_label, "Sorry, I couldn't understand your question.")
|
25 |
|
26 |
-
# Define UI description with sample questions
|
27 |
description = """
|
28 |
### FinTech Chatbot
|
29 |
|
30 |
This chatbot can assist you with a variety of fintech-related queries. Below are some sample questions you can ask:
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
"""
|
45 |
|
46 |
# Define the Gradio interface
|
|
|
9 |
with open("vectorizer.pkl", "rb") as vectorizer_file:
|
10 |
vectorizer = pickle.load(vectorizer_file)
|
11 |
|
12 |
+
# Define the responses dictionary
|
13 |
responses = {
|
14 |
"activate_my_card": "To activate your card, log in to the app and navigate to the 'Activate Card' section.",
|
15 |
"age_limit": "The minimum age to use this service is 18 years.",
|
16 |
"apple_pay_or_google_pay": "Yes, you can use both Apple Pay and Google Pay with your card.",
|
17 |
+
"atm_support": "Your card is supported by ATMs that display the Visa or Mastercard logo.",
|
18 |
+
"automatic_top_up": "You can enable automatic top-up in the app under the 'Top-Up Settings' section.",
|
19 |
+
"balance_not_updated_after_bank_transfer": "If your balance hasn’t updated after a bank transfer, please wait for 24 hours. If the issue persists, contact support.",
|
20 |
+
"beneficiary_not_allowed": "Ensure that the beneficiary details are correct. Some accounts may have restrictions; check with customer support for clarification.",
|
21 |
+
"cancel_transfer": "To cancel a transfer, go to the 'Transaction History' section in the app and select the transfer you wish to cancel.",
|
22 |
+
"card_about_to_expire": "If your card is about to expire, a replacement will be sent automatically. Contact support if you haven’t received it.",
|
23 |
+
"card_arrival": "New cards usually arrive within 7-10 business days after being issued.",
|
24 |
+
"card_not_working": "If your card isn't working, ensure it is activated and has sufficient balance. Contact support if the issue persists.",
|
25 |
+
"change_pin": "You can change your PIN using the app or at any ATM with your card.",
|
26 |
+
"contactless_not_working": "Ensure your card supports contactless payments and check if the terminal accepts it. If the issue persists, contact support.",
|
27 |
+
"country_support": "Your card is supported in all countries where Visa/Mastercard is accepted. Check the app for restrictions.",
|
28 |
+
"declined_card_payment": "Card payments can be declined due to insufficient balance, incorrect PIN, or restrictions on the merchant. Check your app for details.",
|
29 |
+
"lost_or_stolen_card": "If your card is lost or stolen, block it immediately in the app under the 'Card Management' section and request a replacement.",
|
30 |
+
"pending_card_payment": "Pending payments are usually resolved within 2-3 business days. Contact support if the status doesn't update.",
|
31 |
+
"refund_not_showing_up": "Refunds can take up to 7 business days to appear. Check with the merchant or contact support if it takes longer.",
|
32 |
+
"top_up_failed": "Top-up failures may occur due to incorrect details or insufficient balance in the source account. Check your app for details.",
|
33 |
+
"transfer_not_received_by_recipient": "If the recipient hasn't received the transfer, ensure the details are correct. Contact support for further assistance.",
|
34 |
}
|
35 |
|
36 |
# Define chatbot response logic
|
|
|
39 |
predicted_label = clf.predict(vectorized_input)[0]
|
40 |
return responses.get(predicted_label, "Sorry, I couldn't understand your question.")
|
41 |
|
42 |
+
# Define UI description with a table of sample questions
|
43 |
description = """
|
44 |
### FinTech Chatbot
|
45 |
|
46 |
This chatbot can assist you with a variety of fintech-related queries. Below are some sample questions you can ask:
|
47 |
|
48 |
+
<table>
|
49 |
+
<tr>
|
50 |
+
<th>Category</th>
|
51 |
+
<th>Sample Questions</th>
|
52 |
+
</tr>
|
53 |
+
<tr>
|
54 |
+
<td>Activate My Card</td>
|
55 |
+
<td>How do I activate my card? <br> Where can I find the option to activate my card?</td>
|
56 |
+
</tr>
|
57 |
+
<tr>
|
58 |
+
<td>Age Limit</td>
|
59 |
+
<td>What is the minimum age required to use this service? <br> Can a 17-year-old open an account?</td>
|
60 |
+
</tr>
|
61 |
+
<tr>
|
62 |
+
<td>Apple Pay or Google Pay</td>
|
63 |
+
<td>Can I use Apple Pay with my card? <br> Does my card support Google Pay?</td>
|
64 |
+
</tr>
|
65 |
+
<tr>
|
66 |
+
<td>ATM Support</td>
|
67 |
+
<td>Which ATMs can I use my card with? <br> Are there fees for ATM withdrawals?</td>
|
68 |
+
</tr>
|
69 |
+
<tr>
|
70 |
+
<td>Automatic Top-Up</td>
|
71 |
+
<td>How can I set up automatic top-up for my account? <br> Does your app allow automatic balance top-ups?</td>
|
72 |
+
</tr>
|
73 |
+
<tr>
|
74 |
+
<td>Balance Not Updated</td>
|
75 |
+
<td>Why hasn't my balance updated after making a bank transfer? <br> How long does it take for updates to reflect?</td>
|
76 |
+
</tr>
|
77 |
+
<tr>
|
78 |
+
<td>Cancel Transfer</td>
|
79 |
+
<td>Can I cancel a transfer I’ve made? <br> What happens if I cancel a transaction?</td>
|
80 |
+
</tr>
|
81 |
+
<tr>
|
82 |
+
<td>Card Issues</td>
|
83 |
+
<td>Why isn’t my card working? <br> How do I fix issues with a non-functioning card?</td>
|
84 |
+
</tr>
|
85 |
+
</table>
|
86 |
"""
|
87 |
|
88 |
# Define the Gradio interface
|