[英]How to download streamlit output as html file
我在 Streamlit 中生成了交互式輸出; 我需要將輸出下載為本地的 HTML 文件。 通過單擊按鈕,必須啟動下載。 誰能幫我解決這個問題?
您可以閱讀文檔,這里有一個關於.csv文件的示例。
這里我可以舉一個關於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"
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.