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

add application files

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -47,26 +47,25 @@ with gr.Blocks(css=custom_css) as interface:
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"
57
- )
58
- send_button = gr.Button("πŸ“€ Send", variant="primary").style(
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)
66
  history.append((user_message, bot_reply))
67
  return history, ""
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()
 
 
47
  </div>
48
  """)
49
 
50
+ # Organize the chatbot area in a column for vertical stacking
51
+ with gr.Column():
52
+ chatbot = gr.Chatbot(label="πŸ§‘β€βš–οΈ Legal Chatbot Assistant πŸ§‘β€βš–οΈ", height=400, elem_classes=["chatbox"])
53
 
54
+ # Use Row to align input and button horizontally
55
  with gr.Row():
56
+ user_input = gr.Textbox(show_label=False, placeholder="Enter your law question here... βš–οΈ", rounded=True, container=True)
57
+ send_button = gr.Button("πŸ“€ Send", full_width=False, rounded=True)
 
 
 
 
58
 
59
+ # Chat update function to append new messages to the chatbot
60
  def chat_update(user_message, history):
61
  history = history or []
62
  bot_reply = chatbot_interface(user_message)
63
  history.append((user_message, bot_reply))
64
  return history, ""
65
 
66
+ # Connect the button click to the chat update function
67
  send_button.click(chat_update, [user_input, chatbot], [chatbot, user_input])
68
 
69
+ # Launch the Gradio interface with a public shareable link
70
+ interface.launch()
71
+