waleedmohd commited on
Commit
df9b536
·
verified ·
1 Parent(s): b9f9e30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -11
app.py CHANGED
@@ -14,6 +14,19 @@ ONB_GUIDELINES = {
14
  "contact": "الاتصال بنا على الرقم 249-123-456-789 أو عبر البريد الإلكتروني [email protected]."
15
  }
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  # Map Arabic menu options to English keys
18
  OPTION_TO_KEY = {
19
  "التحقق من الرصيد": "balance",
@@ -43,9 +56,6 @@ def respond(option: str):
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:
51
  gr.Markdown("# <center>بنك أم درمان الوطني - المساعد المصرفي</center>")
@@ -53,17 +63,25 @@ with gr.Blocks(css=".gradio-container {direction: rtl;}") as demo:
53
  with gr.Tab("المحادثة"):
54
  gr.Markdown("## اختر أحد الخيارات التالية:")
55
 
56
- # Create buttons for each menu option
57
- with gr.Row():
58
- for option in menu_options:
59
- gr.Button(option).click(
60
- fn=respond,
61
- inputs=gr.Textbox(value=option, visible=False),
62
- outputs=gr.Textbox(label="الرد", interactive=False)
63
- )
 
64
 
65
  # Output textbox for responses
66
  output = gr.Textbox(label="الرد", interactive=False)
 
 
 
 
 
 
 
67
 
68
  with gr.Tab("الإرشادات المصرفية"):
69
  gr.Markdown("## إرشادات بنك أم درمان الوطني")
 
14
  "contact": "الاتصال بنا على الرقم 249-123-456-789 أو عبر البريد الإلكتروني [email protected]."
15
  }
16
 
17
+ # Arabic menu options
18
+ menu_options = [
19
+ "التحقق من الرصيد",
20
+ "الإبلاغ عن فقدان البطاقة",
21
+ "شروط الحصول على قرض",
22
+ "تحويل الأموال",
23
+ "فتح حساب جديد",
24
+ "أسعار الفائدة",
25
+ "فروع البنك",
26
+ "ساعات العمل",
27
+ "الاتصال بالبنك"
28
+ ]
29
+
30
  # Map Arabic menu options to English keys
31
  OPTION_TO_KEY = {
32
  "التحقق من الرصيد": "balance",
 
56
  else:
57
  return "عذرًا، لم يتم التعرف على الخيار المحدد."
58
 
 
 
 
59
  # Omdurman National Bank-specific interface
60
  with gr.Blocks(css=".gradio-container {direction: rtl;}") as demo:
61
  gr.Markdown("# <center>بنك أم درمان الوطني - المساعد المصرفي</center>")
 
63
  with gr.Tab("المحادثة"):
64
  gr.Markdown("## اختر أحد الخيارات التالية:")
65
 
66
+ # Dropdown menu for questions
67
+ dropdown = gr.Dropdown(
68
+ choices=menu_options,
69
+ label="اختر سؤالك",
70
+ interactive=True
71
+ )
72
+
73
+ # Submit button
74
+ submit_btn = gr.Button("إرسال")
75
 
76
  # Output textbox for responses
77
  output = gr.Textbox(label="الرد", interactive=False)
78
+
79
+ # Link dropdown and button to response function
80
+ submit_btn.click(
81
+ fn=respond,
82
+ inputs=dropdown,
83
+ outputs=output
84
+ )
85
 
86
  with gr.Tab("الإرشادات المصرفية"):
87
  gr.Markdown("## إرشادات بنك أم درمان الوطني")