PyLDAvis Component


#1

Hello,

I’m trying to leverage the dash-dangerously-set-inner-html custom component.

I have the following HTML file:

<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/bmabey/pyLDAvis/files/ldavis.v1.0.0.css">
<div id="ldavis_el239681122130198885674280583"></div>
<script type="text/javascript">
...
</script>

It basically renders graphs like the ones in this python notebook: http://nbviewer.jupyter.org/github/bmabey/hacker_news_topic_modelling/blob/master/HN%20Topic%20Model%20Talk.ipynb#topic=0&lambda=1&term= (except my file is available as a standalone .html file)

I tried to include the content of the file in a dash-dangerously-set-inner-html section. It is actually well contained in the page source when I investigate, but I can’t see the graph.

Is there a way I can display this html file in a Dash application?

In advance, thanks.


Show and Tell - Community Thread :tada:
#2

Very much +1! Would like to know this one too, as pyLDAvis and Dash are both amazing would be great to combine them in a Dash app.


#3

You may find the beginning of an answer with the pyldavis_dash custom component I implemented. It’s quick and dirty, but it seems to work fine for my needs.

  • Clone it
  • pip install -e .
  • Argument you pass to data is the var section extracted from the htmlvis generated by pyLDAvis.save_html()