mojtabaa4 commited on
Commit
b3a9df5
β€’
1 Parent(s): 8df9d74

add application files

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -16,9 +16,11 @@ os.system('rm -r content')
16
 
17
  bot = Controller()
18
 
 
19
  def chatbot_interface(user_input, chat_id=2311):
20
  return bot.handle_message(chat_id, user_input)
21
 
 
22
  custom_css = """
23
  @font-face {
24
  font-family: 'Vazir';
@@ -34,7 +36,10 @@ custom_css = """
34
  }
35
  """
36
 
 
37
  with gr.Blocks(css=custom_css) as interface:
 
 
38
  gr.Markdown("""
39
  <div style="text-align: center; font-family: 'Vazir';">
40
  <h1 style="color: #4a90e2;">βš–οΈ RAG Law Chatbot βš–οΈ</h1>
@@ -42,9 +47,10 @@ with gr.Blocks(css=custom_css) as interface:
42
  </div>
43
  """)
44
 
45
- with gr.Box():
46
  chatbot = gr.Chatbot(label="πŸ§‘β€βš–οΈ Legal Chatbot Assistant πŸ§‘β€βš–οΈ", elem_classes=["chatbox"]).style(height=400)
47
 
 
48
  with gr.Row():
49
  user_input = gr.Textbox(show_label=False, placeholder="Enter your law question here... βš–οΈ", elem_classes=["inputbox"]).style(
50
  container=True, border_color="#4a90e2", rounded=True, background_color="#f1f3f4", font_size="16px"
@@ -53,6 +59,7 @@ with gr.Blocks(css=custom_css) as interface:
53
  padding="10px 20px", background_color="#4a90e2", color="white", rounded=True
54
  )
55
 
 
56
  def chat_update(user_message, history):
57
  history = history or []
58
  bot_reply = chatbot_interface(user_message)
@@ -61,4 +68,5 @@ with gr.Blocks(css=custom_css) as interface:
61
 
62
  send_button.click(chat_update, [user_input, chatbot], [chatbot, user_input])
63
 
64
- interface.launch(share=True)
 
 
16
 
17
  bot = Controller()
18
 
19
+ # Define chatbot function
20
  def chatbot_interface(user_input, chat_id=2311):
21
  return bot.handle_message(chat_id, user_input)
22
 
23
+ # Custom CSS to load and apply Vazir font
24
  custom_css = """
25
  @font-face {
26
  font-family: 'Vazir';
 
36
  }
37
  """
38
 
39
+ # Define Gradio interface with legal emojis and enhanced appearance
40
  with gr.Blocks(css=custom_css) as interface:
41
+
42
+ # Introduction and Instructions with law-related emojis
43
  gr.Markdown("""
44
  <div style="text-align: center; font-family: 'Vazir';">
45
  <h1 style="color: #4a90e2;">βš–οΈ RAG Law Chatbot βš–οΈ</h1>
 
47
  </div>
48
  """)
49
 
50
+ with gr.Column(): # Replacing Box() with Column()
51
  chatbot = gr.Chatbot(label="πŸ§‘β€βš–οΈ Legal Chatbot Assistant πŸ§‘β€βš–οΈ", elem_classes=["chatbox"]).style(height=400)
52
 
53
+ # Customize the input box and button area with emojis
54
  with gr.Row():
55
  user_input = gr.Textbox(show_label=False, placeholder="Enter your law question here... βš–οΈ", elem_classes=["inputbox"]).style(
56
  container=True, border_color="#4a90e2", rounded=True, background_color="#f1f3f4", font_size="16px"
 
59
  padding="10px 20px", background_color="#4a90e2", color="white", rounded=True
60
  )
61
 
62
+ # Chat update function
63
  def chat_update(user_message, history):
64
  history = history or []
65
  bot_reply = chatbot_interface(user_message)
 
68
 
69
  send_button.click(chat_update, [user_input, chatbot], [chatbot, user_input])
70
 
71
+ # Launch the Gradio interface with more appealing design and emojis
72
+ interface.launch()