Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -32,14 +32,23 @@ def chat_with_gemini(user_input, chat_history):
|
|
32 |
with gr.Blocks() as iface:
|
33 |
gr.Markdown("# Ken Chatbot")
|
34 |
gr.Markdown("Ask me anything!")
|
35 |
-
|
36 |
chatbot = gr.Chatbot() # Initialize the chatbot
|
37 |
-
msg = gr.Textbox(label="Type your message here...", placeholder="Enter your message and press enter to send your message...") # Text input for user messages
|
38 |
state = gr.State([]) # Store chat history
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
# Set up the interaction for when the user submits a message
|
41 |
msg.submit(chat_with_gemini, [msg, state], [chatbot]) # Update chatbot with new messages
|
42 |
msg.submit(lambda: "", None, msg) # Clear the input box after submission
|
43 |
|
44 |
# Launch the interface with debugging enabled
|
45 |
-
iface.launch(debug=True)
|
|
|
32 |
with gr.Blocks() as iface:
|
33 |
gr.Markdown("# Ken Chatbot")
|
34 |
gr.Markdown("Ask me anything!")
|
35 |
+
|
36 |
chatbot = gr.Chatbot() # Initialize the chatbot
|
|
|
37 |
state = gr.State([]) # Store chat history
|
38 |
|
39 |
+
# Set up the layout with user input on the right
|
40 |
+
with gr.Row():
|
41 |
+
with gr.Column(scale=3):
|
42 |
+
gr.Markdown("### Bot")
|
43 |
+
bot_display = gr.Chatbot() # Bot's chat on the left side
|
44 |
+
|
45 |
+
with gr.Column(scale=1):
|
46 |
+
gr.Markdown("### User")
|
47 |
+
msg = gr.Textbox(label="Type your message here...", placeholder="Enter your message and press enter to send your message...") # User input on the right
|
48 |
+
|
49 |
# Set up the interaction for when the user submits a message
|
50 |
msg.submit(chat_with_gemini, [msg, state], [chatbot]) # Update chatbot with new messages
|
51 |
msg.submit(lambda: "", None, msg) # Clear the input box after submission
|
52 |
|
53 |
# Launch the interface with debugging enabled
|
54 |
+
iface.launch(debug=True)
|