I generated an interactive output in Streamlit; I need to download the output as an HTML file in local. By clicking the button, the download has to be initiated. Can anyone please help me on this?
You can read document, there exists an example about .csv file.
Here I can give an example about html:
import pandas as pd
import streamlit as st
df=pd.read_csv("test.csv")
@st.cache
def convert_df(df):
return df.to_html().encode('utf-8')
html = convert_df(df)
st.download_button(
"Press to Download",
html,
"test.html"
)