TEAMuP-dev / HARP

A sample editing application allowing for hosted, asynchronous, remote processing of audio with machine learning by routing through Gradio endpoints.
BSD 3-Clause "New" or "Revised" License
43 stars 3 forks source link

Cancelling models hangs #219

Open NathanPruyne opened 1 week ago

NathanPruyne commented 1 week ago

If processing is taking a long time, hitting the cancel button can cause the whole application to freeze, and need to be force quit.

xribene commented 3 days ago

This is partially solved by #213 , meaning that it doesn't hang now (I tried by adding time.sleep(xx) in process_fn() )

The real problem is that Gradio doesn't really support "cancel".

Here is a discussion on what "canceling" really means. https://github.com/gradio-app/gradio/issues/7593

It actually seems to be a common feature request, so it might happen soon: https://github.com/gradio-app/gradio/issues/9415

The way it is now, even if you click "cancel", we are still waiting for the "process" to finish. After process is finished, we internally run an something like an "undo" (I think) to go back to the unprocessed files : https://github.com/TEAMuP-dev/HARP/blob/main/src/MainComponent.h#L879C1-L881C11

Even if we would make it so that we click "cancel" and we immediatelly get the "process" button back, the remote app would be still running the previous processing step.

xribene commented 2 days ago

Maybe we need a way to cancel an http request. This is not suppoerted by JUCE though, and it could be tricky to implement. If we had that, means that we wouldn't have to wait for the "process" to finish and then do the "undo" step.

However, this doesn't prevent the remote model from keep processing the canceled request, and then we need to figure out what will happen if the user hits "process" again in HARP before the previous processing step is finished.