Saving streamlit application to a webpage

Is there way to save the result of a streamlit application to an html page? For example, in altair there is a save function that allows for saving the resulting chart(s) to a webpage which can then be opened by a user. If there is no such feature, I am interested in possibly working on a feature that allows people to save their work to an html page.

Thank You

Hello @mozartfish, welcome to the forum :slight_smile:

I can see two Github issues that could be of interest :

Can you add a more detailed view of how you would imagine this, and eventually signal your interest to contribute on whichever issue is the closest to you :tada: ? Thanks !

What I mean by more detailed is some behaviors youโ€™d like to keep in the standalone HTML. For example, do you only need exporting all Markdown/sidebar/Altair/Plotly/Matplotlib widgets as HTML/images, or also would need for example handling every interactive Streamlit widget (example, text input and using its value to rebuild a new Altair chart, which my 2 cents doesnโ€™t look immediately possible because we lose the Python processing in the pure standalone HTML process) ?

Fanilo

1 Like

Hi, Thank you for the response. I am interested in the second post titled: export to standalone HTML. Iโ€™m currently trying to find a way to take a streamlit application that I have made and save the output charts created with altair with the streamlit functionality and design. By save function, I was wondering if streamlit has something to altairโ€™s save function: https://altair-viz.github.io/user_guide/saving_charts.html. For example, I would like to build a textbox that allows users to specify stuff and generate charts that can be saved to the browser using a save function.

Thanks

AFAIK this is not currently supported, I propose you draft your thoughts on the Github issue then and then weโ€™ll see what this implies on the implementation side :wink:

Is there any progress in this function (i.e saving streamlit app to a static webpage to create interactive report)?

One solution would be using Datapane inside your streamlit appโ€™s code (app.py) to output your desired page(s) to a interactive report - see example below:

m = folium.Map(width=340,height=580,location=[lat, lon], tiles='cartodbpositron', zoom_start=8)
import datapane as dp
from datetime import date
dp.login(token="your token from datapane")
dp.Report(
                f"""
            _Analysis built {date.today()}_
                """,
                dp.Group(
                    dp.Plot(m, caption='Geographical interest'),
                    columns=1
                ),
            ).publish(name="map3", open=True)
1 Like