Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -517,7 +517,9 @@ def handle_query(user_question, chatbot, audio=None):
|
|
| 517 |
stop_event.clear()
|
| 518 |
print(user_question)
|
| 519 |
if future and not future.done():
|
| 520 |
-
|
|
|
|
|
|
|
| 521 |
print(user_question)
|
| 522 |
# Start the processing in a new thread
|
| 523 |
future = executor.submit(answer_question_thread, user_question, chatbot)
|
|
@@ -543,7 +545,9 @@ def handle_query(user_question, chatbot, audio=None):
|
|
| 543 |
chatbot.append((user_question1, response_text1))
|
| 544 |
return gr.update(value=chatbot)
|
| 545 |
except Exception as e:
|
| 546 |
-
|
|
|
|
|
|
|
| 547 |
|
| 548 |
|
| 549 |
def stop_processing(chatbot):
|
|
|
|
| 517 |
stop_event.clear()
|
| 518 |
print(user_question)
|
| 519 |
if future and not future.done():
|
| 520 |
+
chatbot.append(("","A query is already being processed. Please stop it before starting a new one."))
|
| 521 |
+
return gr.update(value=chatbot)
|
| 522 |
+
|
| 523 |
print(user_question)
|
| 524 |
# Start the processing in a new thread
|
| 525 |
future = executor.submit(answer_question_thread, user_question, chatbot)
|
|
|
|
| 545 |
chatbot.append((user_question1, response_text1))
|
| 546 |
return gr.update(value=chatbot)
|
| 547 |
except Exception as e:
|
| 548 |
+
print [(f"Error occurred: {e}", "")]
|
| 549 |
+
chatbot.append((user_question, "Sorry, we encountered an error while processing your request. Please try after some time."))
|
| 550 |
+
return gr.update(value=chatbot)
|
| 551 |
|
| 552 |
|
| 553 |
def stop_processing(chatbot):
|