Spaces:
Runtime error
Runtime error
add application files
Browse files
app.py
CHANGED
@@ -47,26 +47,25 @@ with gr.Blocks(css=custom_css) as interface:
|
|
47 |
</div>
|
48 |
""")
|
49 |
|
50 |
-
|
51 |
-
|
|
|
52 |
|
53 |
-
#
|
54 |
with gr.Row():
|
55 |
-
user_input = gr.Textbox(show_label=False, placeholder="Enter your law question here... βοΈ",
|
56 |
-
|
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
|
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 |
+
|