Voila usecase when waiting on user input


I cannot find any tutorial on how to deploy a Jupyter Notebook via Voila, when the notebook execution depends on user input in the beginning. In my Notebook the user specifies a directory with .tif files. Then a neural network is either trained on these files or just predicts on this files. In the end the predictions are saved to a separate directory.

I think Voila depends on every cell to the end being executed. I saw the ipython_blocking package and several discussions and PRs on the voila Github page. I am trying to use ipython_blocking now, but it does not seem to work as expected.

Is there are tutorial out there that explains how to do this?


Voila rendering does depend on executing every cell but your code can define listeners / hooks /callbacks using .observe() or you can even make buttons. Both of those avenues can define reactions to do upon certain events and so even though the code defining the widgets runs, they can still respond to user actions. Using this I made a notebook that runs in Voila that allows you to add .tsv files in addition to the demo file included. You then highlight the file you want to act on and press a button to process the .tsv file. I sort of based it on here (see here) and here with some further customization. I haven’t fully integrated my result into a series of other notebooks, but you can find it and see it in action by going here, launching Binder, going to the dashboard, and selecting the notebook ‘3D_scatter_Voila_matplotlibADJUSTABLE.ipynb’ from the listed files. When you launch that notebook, you can select the ‘Voila’ button from the toolbar along the top.