Update app.py
Browse files
app.py
CHANGED
@@ -60,11 +60,11 @@ def run_graph(input_message, history, user_details):
|
|
60 |
q = queue.Queue()
|
61 |
thread = threading.Thread(target=invoke_workflow, args=(q,))
|
62 |
thread.start()
|
63 |
-
thread.join(timeout=
|
64 |
|
65 |
if thread.is_alive():
|
66 |
logger.error("Workflow timed out.")
|
67 |
-
return "The request
|
68 |
return q.get()
|
69 |
|
70 |
|
@@ -250,4 +250,4 @@ with gr.Blocks() as demo:
|
|
250 |
outputs=[bmi_output, calorie_output, bmi_chart_calc]
|
251 |
)
|
252 |
|
253 |
-
demo.launch(share=True)
|
|
|
60 |
q = queue.Queue()
|
61 |
thread = threading.Thread(target=invoke_workflow, args=(q,))
|
62 |
thread.start()
|
63 |
+
thread.join(timeout=30) # Wait for 30 seconds
|
64 |
|
65 |
if thread.is_alive():
|
66 |
logger.error("Workflow timed out.")
|
67 |
+
return "The request is taking longer than expected. Please try again later or modify your query."
|
68 |
return q.get()
|
69 |
|
70 |
|
|
|
250 |
outputs=[bmi_output, calorie_output, bmi_chart_calc]
|
251 |
)
|
252 |
|
253 |
+
demo.launch(share=True)
|