0

I used the following code to create a dashboard in a google colab notebook:

!pip install --upgrade hvplot
!pip install --upgrade pyngrok
!pip install --upgrade pyngrok tornado
!pip install --upgrade bokeh
!pip install --upgrade holoviews
import pandas as pd
import numpy as np
import panel as pn
import bokeh
import tornado
import pyngrok
from pyngrok import ngrok
import hvplot.pandas
from bokeh.plotting import figure
pn.extension('tabulator')

# Generate some random data for the graph
x = np.linspace(0, 10, 100)
y = np.sin(x)

# Create the graph component using Bokeh
plot = figure(title='Sine Wave', width=400, height=300)
plot.line(x, y, legend_label='y=sin(x)', line_width=2)

# Create the BootstrapTemplate
template = pn.template.BootstrapTemplate(title='Graph Template')

# Create the sidebar components
sidebar = pn.Column(
    "# Graph Template",
    "This is a simple example of a graph template.",
)

# Create the main content components
content = pn.Column(
    pn.pane.Markdown("## My Graph"),
    pn.pane.Bokeh(plot),
)

# Set the sidebar and content
template.sidebar.append(sidebar)
template.main.append(content)

# Show the template
local_url = template.show()

port=local_url.port

ngrok.set_auth_token("<Insert Auth Token>") #Needs to be changed to your ngrok token

ngrok.kill()

# Start ngrok and create a public URL
ngrok_tunnel = ngrok.connect(port)


# Print the public URL
public_url = ngrok_tunnel.public_url
print(" * ngrok tunnel \"{}\" -> \"http://127.0.0.1:{}\"".format(public_url, port))

The website found at the public url however only displays the title "Graph Template" and apart from that nothing else. I tried using matlab and other widgets from the panel package but none worked. Any ideas how to get this to work?

mosc9575
  • 5,618
  • 2
  • 9
  • 32
j42
  • 31
  • 3

0 Answers0