Update app.py
Browse files
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 |
-
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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)
|