Panel showing early with loading indicator for slow loading Notebook

Hey there,
I have a fairy complex Notebook, which takes about half a minute to load.

Regarding the internal structure, I use the BootstrapTemplate, whereas template.servable() gets called at the last cell in my Notebook. Now, panel does not display anything during the execution time, which gives the impression of a stuck process or faulty behavior until the panel UI shows up eventually.

It would be nice to have some rudimentary panel elements show up early and give the user early visual cues, like a loading indicator (panel provides this already: Loading Indicator — Panel v1.3.9a1).

So my question is: Is there any way to serve panel elements before I call template.servable at the bottom of my Notebook? A heavy Notebook may take a while to finish executing and only serving its contents at the end of execution is not ideal in this case.

Check out

Specifically comments about onload

1 Like

You can also try serving your notebook/app with panel serve nb.ipynb --reuse-sessions --global-loading-spinner. The first time the app is visited you won’t see a difference but after that the template will be displayed immediately, with a loading spinner displayed until the app is fully loaded.