Any luck using html.Script for GitHub Gists

Hi there - -model_view_bert.ipynb · GitHub

I have a gist and I am trying to use it in the script html component function, a few hours I have given up. Let me know if anyone hase any luck?

Hi @chriddyp, do you know if this has been attempted before? I am sure more and more people would like to embed jupyter notebooks inside dash notebooks - is there another way to do this?

This would be a nice function as it would allow us to make Google Colab snippets appear in Dash.

I have looked around on the forum, and I don’t think that this has been answered yet. I wonder what the solution will be.

In the past I’ve seen issues where github links don’t have the correct “content-type” - they set the content type to text/plain or html, rather than e.g. javascript.

I used to use rawgit to get around this. Looks like it has since been discontinued, but the mentioned some other alternatives. See:

Hello @snowde
I know that I’m late, but here is my solution (it’s not the optimal way but it’s working)

1. Create a new html file : file.html

2. Embed your Gist into that file:
—> Firstly make your Gist as public
—> Copy the script link and past it into the html file

<body>
  <script src="link/to/your/gist.js"></script>
</body>

alternatively you can read this Medium article for more insights

4. Embed the html file in your dash app :
using the Iframe html dash compenent


html.Iframe(src='path/to/your/file.html',width='100%',height='530px')
1 Like