Skip to content

Instantly share code, notes, and snippets.

@CharlyWargnier
Created May 30, 2022 18:31
Show Gist options
  • Save CharlyWargnier/fc8989ceaf4ac627efbd49be6693b6e9 to your computer and use it in GitHub Desktop.
Save CharlyWargnier/fc8989ceaf4ac627efbd49be6693b6e9 to your computer and use it in GitHub Desktop.
Streamlit - download_csv via markdown
df = pd.read_csv("reuters-allcats.csv")
csv = df.to_csv(index=False)
b64 = base64.b64encode(csv.encode()).decode()
href = f'<a href="data:file/csv;base64,{b64}" download="myfilename.csv">Try a sample first</a>'
st.markdown("👆 Upload a .csv file. " + href, unsafe_allow_html=True)
st.stop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment