There is jupyerlite which does exactly that https://github.com/jupyterlite/jupyterlite
Kernels are compiled to wasm and can therefore run in the browser.
Try it out at: https://jupyterlite.readthedocs.io/en/stable/_static/lab/ind...
Its easy to create your own deployments, there is a template repo for that https://github.com/jupyterlite/demo