my goals is to share custom files through my Streamlit app such as jupyter notebook file (.ipynb) or GeoJson (.geojson).
I know Streamlit provide a download button which I can use to share file. Let’s me share with you an example:
import streamlit as st import nbformat as nbf # build my notebook notebook = nbf.v4.new_notebook() # enriched my notebook notebook["cells"] = [nbf.v4.new_markdown_cell("Blablabla"), ...] # create my download button st.download_button("Download the notebook", notebook, mime="application/vnd.jupyter")
This is not working !
I am not sure if I made a mistake in my choice for the parameters “mime” or I need to format the notebook to an other format
You can overpass the problem by formating the notebook in an html file :
html_exporter = HTMLExporter() html_data, _ = html_exporter.from_notebook_node(notebook) st.download_button("Download the notebook", notebook, mime="text/html")
But I feel more confortable with a notebook file !
Any idea guys ? (: