MatplotLib Animation: Decay example with streamlit, nothing plotted

I have enclosed a code, which is basically the decay example of Matplotlib animation class, which is supposed to plot an animating sine wave, decaying, which runs fine when running the script from Spyder, but then when comment out plt.show() and try running it with steamlit, the axes show on the page, but no plot is being drawn.

Code

import itertools

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import streamlit as st

drawing1= st.empty()

def data_gen():
    for cnt in itertools.count():
        t = cnt / 10
        yield t, np.sin(2*np.pi*t) * np.exp(-t/10.)
        #the_plot.pyplot(plt)


def init():
    ax.set_ylim(-1.1, 1.1)
    ax.set_xlim(0, 10)
    del xdata[:]
    del ydata[:]
    line.set_data(xdata, ydata)
    return line,

fig, ax = plt.subplots()
line, = ax.plot([], [], lw=2)
ax.grid()
xdata, ydata = [], []


#the_plot = st.pyplot(plt)


def run(data):
    # update the data
    t, y = data
    xdata.append(t)
    ydata.append(y)
    xmin, xmax = ax.get_xlim()

    if t >= xmax:
        ax.set_xlim(xmin, 2*xmax)
        ax.figure.canvas.draw()
    line.set_data(xdata, ydata)
    #the_plot.pyplot(plt)
    #the_plot.write(ax)
    #the_plot.write(fig)
    #the_plot.write(plt)
    
    drawing1.pyplot(plt)

    return line,

ani = animation.FuncAnimation(fig, run, data_gen, interval=10, init_func=init)
#the_plot.pyplot(plt)  
plt.show()
#the_plot.pyplot(plt)