How to display visualization outise of Jupyter and webserver
I would like to use the library directly in plain python, however, it isn't clear to me how to do that. Also I will appreciate if someone can explain why we need to build with bazel and run a server to display the visualization. Why we can't just construct the html page through python code and open it with a browser. I looked into the code of https://pair-code.github.io/facets/index.html as well as the functional tests however I couldn't come up with the way to do it.
I am aware of the different issues including https://github.com/PAIR-code/facets/issues/15 however none of them has clear and thorough answer.
it would be nice to have a guide of possible ways of using the library:
- Jupyter (this is already there).
- In a web server
- with plain python
thanks :)
Right now the project is optimized for use in Jupyter or with a web server. In the future we should put together a real guide on using it with a webserver.
I suppose you could construct an html page that is usable in a browser without a webserver, as this is basically how the demo webpage works.
https://github.com/PAIR-code/facets/blob/gh-pages/index.html is the code for the demo webpage. The basic idea there is:
- https://github.com/PAIR-code/facets/blob/gh-pages/index.html#L44 - load webcomponents-lite script
- https://github.com/PAIR-code/facets/blob/gh-pages/index.html#L308 - On WebComponentsReady event, import the pre-built facets-jupyter.html from facets-dist directory in this repo.
- https://github.com/PAIR-code/facets/blob/gh-pages/index.html#L312 - On load of that import, create the facets polymer elements in the page
- https://github.com/PAIR-code/facets/blob/gh-pages/index.html#L234 - Then provide data to the facets polymer elements.