Pijush2023 commited on
Commit
613256c
·
verified ·
1 Parent(s): 43badf5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -76,13 +76,18 @@ def rag_chain_response(messages, user_message):
76
 
77
  # Define the Gradio app
78
  with gr.Blocks(theme="rawrsor1/Everforest") as app:
79
- gr.Markdown("## Welcome to Annie's Chatbot - Your Friendly Guide to Birmingham!")
80
 
81
  chatbot = gr.Chatbot([], elem_id="RADAR", bubble_full_width=False)
82
  question_input = gr.Textbox(label="Ask a Question", placeholder="Type your question here...")
83
  submit_btn = gr.Button("Submit")
84
 
85
- # Set up interaction
 
 
 
 
 
86
  submit_btn.click(
87
  rag_chain_response, # Function to handle input and generate response
88
  inputs=[chatbot, question_input], # Pass current conversation state and user input
 
76
 
77
  # Define the Gradio app
78
  with gr.Blocks(theme="rawrsor1/Everforest") as app:
79
+
80
 
81
  chatbot = gr.Chatbot([], elem_id="RADAR", bubble_full_width=False)
82
  question_input = gr.Textbox(label="Ask a Question", placeholder="Type your question here...")
83
  submit_btn = gr.Button("Submit")
84
 
85
+ # Set up interaction for both Enter key and Submit button
86
+ question_input.submit(
87
+ rag_chain_response, # Function to handle input and generate response
88
+ inputs=[chatbot, question_input], # Pass current conversation state and user input
89
+ outputs=[chatbot, question_input] # Update conversation state and clear the input
90
+ )
91
  submit_btn.click(
92
  rag_chain_response, # Function to handle input and generate response
93
  inputs=[chatbot, question_input], # Pass current conversation state and user input