Gradio cancel a running process
Is there a way to cancel a running process if it is taking too long to complete? I’ve looked at the cancels for abutton.click(). Which is being discussed hereIs there a way to kill a function in mid proccess? - Gradio - Hugging Face ForumsBut I don’t seem to be able to get it to work.My button click event looks like the following:send_chat = txt.submit(update_human_message, [chatbot, txt, memory], [chatbot, txt, memory])
btn.click(fn=None, inputs=None, outputs=None, cancels=[send_chat], queue=False)

#calling the gradio app
demo.queue(concurrency_count=2, max_size=20).launch()Could someone please guide me?
2023-08-15T15:24:02Z
Hi@bhashithewhat happens when you click on the button? Does the process get canceled in the frontend?
2023-08-15T15:55:59Z
Hi@abidlabsNothing really happens on the frontend, but i can see that theresetandpredictresponses.resethas a response{"success":true}predicthas a response{"data":[],"is_generating":false,"duration":0.0,"average_duration":0.0}The textbox shows still running even after clicking the button which triggers the cancel event. After a while we get the response for the query which was initially sent (even though this was cancelled)
2023-08-15T16:08:33Z
Can you provide a self-contained code example we can use to reproduce?