Plotting not updating in real-time when streaming and using send and onload

I am trying to get the streaming to work such that as data values are sent using send, the plot in the dashboard is updated in real-time.

I tried to attach the notebook I am using but Discourse didn’t seem to let me. So here is the script.

What am I doing wrong? Thanks in advance.

#!/usr/bin/env python
# coding: utf-8

import time
import numpy as np
import pandas as pd
import holoviews as hv
import panel as pn
from holoviews import opts
from holoviews.streams import Buffer


example = pd.DataFrame({'x': [], 'y': [], }, columns=['x', 'y',])
dfstream = Buffer(example, length=4, index=False)
curve_dmap = hv.DynamicMap(hv.Curve, streams=[dfstream])

def view(curve_dmap):
    template = pn.template.FastGridTemplate(
        title="Streaming Dashboard example",

    template.main[0:7, 0:12] = pn.Column(curve_dmap)
    return template

curve_dmap.opts(color='green', xlim=(-10, 10),  ylim=(-10, 10), show_legend=True)

def run():
    for i in range(7):
        dfstream.send(pd.DataFrame([(np.random.randn(), np.random.randn(),)], columns=['x', 'y', ]))

if __name__.startswith("bokeh"):