This is a great app. Thank you for your hard work.
Wondering if it is possible to render all python scripts as apps from a folder or file list?
This is a great app. Thank you for your hard work.
Wondering if it is possible to render all python scripts as apps from a folder or file list?
Hi Rahul_B!
While Streamlit doesnāt come with support for running multiple apps from a given folder, you can always write your own Python script to do that. Which is exactly what I did below
Try this:
Save the file below as run_all.py
:
https://gist.github.com/tvst/f63ab0d34a20bcae86504812cf3de32c
Run this on a terminal:
python run_all.py some/folder/
And thatās it! Let me know if this works out for you.
Thanks @thiago.
run_all.py script runs each app as a seperate port. Was wondering if it is possible to run multiple apps in single port and with links to each app.
Oh, I see what you mean.
This isnāt supported right now in the exact way youāre describing. But you can make a Streamlit app that has a selectbox that lets you choose other apps to run inline in that same browser window. This means the selectbox will always be visible, even when you go into other sub-apps.
See this Gist: https://gist.github.com/tvst/f13b24198e256c1c4d9b5ccbc6991cc2
Hi Rahul
Iāve created a multipage app here https://github.com/marcskovmadsen/awesome-streamlit.
You can take a look at the src/app.py file and the src/pages folder for inspiration. If you can improve it even further I would like to know.
Thanks.
I am using something based on the gist @thiago posted, however streamlit doesnāt detect changes in the file which has been opened and execed. Is there a way to make this work?
Hi @Zach_Dwiel, Iāve updated the Gist to support this.
The basic idea is that Streamlit looks at all modules in sys.modules
whose source file lives in the main fileās folder (including subfolders). So in the Gist above I now add modules to sys.modules
just so Streamlit will watch them
that did the trick, thanks!
These Gists are pretty smart, thank you!
To run multiple streamlit apps on the same server in a more robust manner (and not inline), please see streamlit-launchpad which runs each app in a separate process and at a sub-folder URL.
So if I run streamlit-launchpad on a folder, the root at / shows a basic list of available apps. If I click into /app1.py/ it will launch the app1.py streamlit in a new process (and on a new port, but proxied through).
As ever, hopefully Streamlit will build this functionality natively soon!
Iām facing the same problem. @danlester will your package work if ran as an entrypoint of a served docker container? Iām asking because I noticed in the code the usage of localhost
and it made me a little worried.
Ideally, indeed, streamlit
should expose a functionality to serve different apps. I cast my vote for that.
Yes, streamlit-launchpad runs well in Docker.
Here is a basic image with streamlit and launchpad installed - mount your app folder to /app in the container as given in the example below:
https://hub.docker.com/r/ideonate/streamlit-launchpad
And another one with some more scientific Python packages preinstalled:
https://hub.docker.com/r/ideonate/streamlit-launchpad-scipy
The use of ālocalhostā within the container is when the launchpad application starts the Streamlit sub-processes, as these are designed to run entirely within the container. Web traffic externally to the container needs only to be forwarded to the launchpad app itself, which then proxies to the relevant (localhost) Streamlit processes.
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.