Integrating Streamlit with another techology for interacting dashboard

I cant create interactive Dashboards here but I have used streamlit fto create UI for my ML model. how can I integrate my Streamlit python script with something else to create an interactive dashboard.
Can I use Plotly Dash in anyway through streamlit.
Or call another url or service that would direct me to Dashboard, but the dashboard should be of real time data.

Hi @nnpy,
can you spec out the experience you are looking for? How do Streamlit and the dashboard interact? Is Streamlit generating data for your dashboard? If so, for example, you could pipe the data generated by streamlit to storage and point your dashboard at this storage. Up to you which technology you want to use for storage.

Best,
Matteo

Hi @monchier ,
Thanks for your response. I have created an web app (using Streamlit), based on ML model, that predicts the results and visualize it. Now the visualization (dashboard) should be open (based on the results) as the person press the button from the Streamlit web app. The dashboard could be open in the new window as well (whatevr works).

Write now don’t have a db, so data generated from streamlit could be stored in an excel file, and maybe use that file for dashboard but how I can I make can I make that dashboard part of my streamlit app (as mentioned above). where dashboard is opened through streamlit command.
Not sure if I am able to articulate that :blush:

Also could you please elaborate more about piping the generated data?

Thanks
Nayaab

Hi @nnpy,
to respond to your first item, you can have a link in the Streamlit App that points at your dashboard. Suppose you deploy a Grafana server for the Dashboard (or any other technology that suits you). You would just have a simple hyperlink in Streamlit to take you to the dashboard. I am assuming that a dashboard is long lived, so, once, you open a browser at it, the dashboard will track your results while you are generating them.

As for the data, a DB would makes things more robust. For example, you can publish your results to BigQuery. The the dashboard can read from it. Not sure, how your Streamlit app is generating data. I am assuming, a user interacts with the app and kicks in a flow that generates the results. Every time this flow is run, a new set of results gets generated and published.

If you want to stick with the excel file, you can publish your excel file to some storage, like Amazon S3. Then, the dashboard can read the excel file from there. It may be a bit tricky to append rows than with the DB, so you will have to manage that.

Hope it helps,
Matteo

1 Like

I believe you can do what you want all with streamlit if you organize your streamlit app as a mult-page app using an unofficial extension made by Marc Skov Madsen. Visit his awesome-streamlit repo for more details. You can look at the src/pages directory and reverse engineer how to make a multi-page app with streamlit. Not sure if streamlit will ever adopt a multi-page feature, but I see that there is a feature request to support plug-ins.

Basically, you would make one page to perform the ML modeling function and visualizations. Then on a different page, you can make a streamlit dashboard. However, if the dashboard requires complex layout of components/widgets, then streamlit may not meet your needs. There are currently feature requests for streamlit to have a flexible layout system and to also support tabs. Furthermore, streamlit wasn’t originally designed to handle sessions, but the latest versions of streamlit now support an experimental session mechanism. So if your dashboard page needs to handle widget states and complex callbacks, you would have to take a deeper look at the new sessions feature.

If you are open to other frameworks, I would take a look at Holoviz Panel, as it supports multi-page apps out of the box, supports tabs, and can handle widget callbacks and sessions.

You can mix things up: Make a streamlit app and then have a link on it for the user to visit a Panel dashboard app which pulls or obtains data that your streamlit app stored in a database or Excel file or whatever data persistence store you want to use.

1 Like

Hi @monchier,
Thanks for such a clarified explanation. I had a vague idea about the possibility through a similar process but this is much clear now.

Thanks
Nayaab