Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,19 @@ ONB_GUIDELINES = {
|
|
14 |
"contact": "الاتصال بنا على الرقم 249-123-456-789 أو عبر البريد الإلكتروني info@onb.sd."
|
15 |
}
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
# Set up logging for analytics
|
18 |
logging.basicConfig(filename='chatbot_queries.log', level=logging.INFO)
|
19 |
|
@@ -21,21 +34,17 @@ def respond(option: str):
|
|
21 |
# Log the selected option
|
22 |
logging.info(f"Selected Option: {option}")
|
23 |
|
|
|
|
|
|
|
24 |
# Return the corresponding response
|
25 |
-
|
|
|
|
|
|
|
26 |
|
27 |
# Arabic menu options
|
28 |
-
menu_options =
|
29 |
-
"التحقق من الرصيد",
|
30 |
-
"الإبلاغ عن فقدان البطاقة",
|
31 |
-
"شروط الحصول على قرض",
|
32 |
-
"تحويل الأموال",
|
33 |
-
"فتح حساب جديد",
|
34 |
-
"أسعار الفائدة",
|
35 |
-
"فروع البنك",
|
36 |
-
"ساعات العمل",
|
37 |
-
"الاتصال بالبنك"
|
38 |
-
]
|
39 |
|
40 |
# Omdurman National Bank-specific interface
|
41 |
with gr.Blocks(css=".gradio-container {direction: rtl;}") as demo:
|
@@ -66,5 +75,4 @@ if __name__ == "__main__":
|
|
66 |
server_name="0.0.0.0",
|
67 |
server_port=7860,
|
68 |
share=True # Enable public link
|
69 |
-
)
|
70 |
-
|
|
|
14 |
"contact": "الاتصال بنا على الرقم 249-123-456-789 أو عبر البريد الإلكتروني info@onb.sd."
|
15 |
}
|
16 |
|
17 |
+
# Map Arabic menu options to English keys
|
18 |
+
OPTION_TO_KEY = {
|
19 |
+
"التحقق من الرصيد": "balance",
|
20 |
+
"الإبلاغ عن فقدان البطاقة": "lost_card",
|
21 |
+
"شروط الحصول على قرض": "loan",
|
22 |
+
"تحويل الأموال": "transfer",
|
23 |
+
"فتح حساب جديد": "new_account",
|
24 |
+
"أسعار الفائدة": "interest_rates",
|
25 |
+
"فروع البنك": "branches",
|
26 |
+
"ساعات العمل": "working_hours",
|
27 |
+
"الاتصال بالبنك": "contact"
|
28 |
+
}
|
29 |
+
|
30 |
# Set up logging for analytics
|
31 |
logging.basicConfig(filename='chatbot_queries.log', level=logging.INFO)
|
32 |
|
|
|
34 |
# Log the selected option
|
35 |
logging.info(f"Selected Option: {option}")
|
36 |
|
37 |
+
# Map the Arabic option to the English key
|
38 |
+
key = OPTION_TO_KEY.get(option)
|
39 |
+
|
40 |
# Return the corresponding response
|
41 |
+
if key:
|
42 |
+
return ONB_GUIDELINES.get(key, "عذرًا، لم يتم التعرف على الخيار المحدد.")
|
43 |
+
else:
|
44 |
+
return "عذرًا، لم يتم التعرف على الخيار المحدد."
|
45 |
|
46 |
# Arabic menu options
|
47 |
+
menu_options = list(OPTION_TO_KEY.keys())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
# Omdurman National Bank-specific interface
|
50 |
with gr.Blocks(css=".gradio-container {direction: rtl;}") as demo:
|
|
|
75 |
server_name="0.0.0.0",
|
76 |
server_port=7860,
|
77 |
share=True # Enable public link
|
78 |
+
)
|
|