Can I return my panel code as HTML?


I wonder if I can write notebook with panel controls and then get the HTML code out of it?
I want to integrate with jupyter kernel gateway which requires me to return html type from API.


I think Deploy and Export — Panel 0.11.3 documentation"test.html")

1 Like

is there an option to return it without saving it to file?

and another thing I tried it for this code:

def callback(value):
return ‘%d * 5 = %d’ % (value, value*5)

row = pn.Row(slider, callback)‘test.html’)

and when opening the html page any change in slider doesn’t affect the text as expected (and works in jupyter notebooks)'test.html', embed=True)

1 Like

Thanks, it makes it working but it allows user to select only 0,5,10 numbers in slider instead of every number between 0-10 as in notebook.

Read Deploy and Export — Panel 0.11.3 documentation under Embedding

1 Like

Thanks, I solved it. If there is way to get the HTML in memory instead of saving to file I will be happy to hear.

.embed() maybe

You could use something like:

from io import StringIO

st = StringIO(), embed=True)

html =

(Not tested)