HaryaniAnjali commited on
Commit
5d4f3f5
·
verified ·
1 Parent(s): 48ae2b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -132,10 +132,15 @@ with gr.Blocks(title="Generative AI Q/A System") as demo:
132
  chatbot = gr.Chatbot()
133
  msg = gr.Textbox(label="Your Question")
134
  clear = gr.Button("Clear")
135
-
136
  def respond(message, history):
137
- response = qa_system.process_query(message)
138
- return response
 
 
 
 
 
139
 
140
  msg.submit(respond, [msg, chatbot], [chatbot])
141
  clear.click(lambda: None, None, chatbot, queue=False)
 
132
  chatbot = gr.Chatbot()
133
  msg = gr.Textbox(label="Your Question")
134
  clear = gr.Button("Clear")
135
+
136
  def respond(message, history):
137
+ try:
138
+ response = qa_system.process_query(message)
139
+ return "", history + [(message, response)]
140
+ except Exception as e:
141
+ error_message = f"Error processing query: {str(e)}"
142
+ return "", history + [(message, error_message)]
143
+
144
 
145
  msg.submit(respond, [msg, chatbot], [chatbot])
146
  clear.click(lambda: None, None, chatbot, queue=False)