Hi. I discovered streamlit last week and enjoyed working with so much that I ended up writing a small app for fitting experimental data.
However, there are a few things that the app is missing before I can make it available to everyone:
First thing is a file uploader from the client to the server (so the users can upload their own data that the app then reads). I believe this is work in progress (https://github.com/streamlit/streamlit/issues/120) so I just need to be patient.
I want the user to be able to download the output data from the fitting. I’ve managed to store the data in a file on the Heroku server where my app is working on, however, I’m not sure how to create a download link for the file.
Last thing, it would be great if we could display simple math equations, not only in streamlit.text but also streamlit.selectbox although that is not very important for now in my case.
Definitely agree here! Right now I’m having the users enter the email address, and then receive the data via email (or worse, copy and paste the dataframe if it’s small enough).
It would be so great if the users could simply download the data directly from the browser!
Hello, @Emmanuel_Pean! Welcome to Streamlit, and thanks for your suggestions!
Yeah - as you noted, we’re working on a File Uploader Widget that will be released in a couple of weeks. (This has been a very frequent feature request, so we’re prioritizing it.)
Streamlit does not have a way to serve file downloads. We’re tracking that request at this Github issue - please feel free to thumbs-up the issue if it’s important to you; we take user demand into consideration when prioritizing new feature development!
As a workaround for file download support, here’s a Gist that demonstrates patching Streamlit to allow static file downloads: https://gist.github.com/tconkling/1e5ead87c796a82de7fa71fcc4a74777. (And of course, it probably goes without saying, but you want to be very careful about what resources you expose to the internet!)
Great, I look forward to see (1) and (3) implemented in streamlit!
Thanks for the link to the request for downloading files. I’ve modified the side-packages/streamlit/server/Server.py file using the gist you provided, however, when I try to run the app locally, it just doesn’t display anything anymore (the page is completely blank).
Any idea what is the problem?
Whoops, looks like I forgot to note that you also need to add import os to Server.py, before the TORNADO_SETTINGS dict. I’ve updated the gist - can you give that a try?
If it doesn’t work, can you paste any console output that you get from streamlit run ...? I’ve tested this locally, but not extensively across different OSs and Python versions.
I’m not getting any error message when running the app locally. I did a few tests and here’s what I found: It works after I add "static_path": os.path.join(os.getcwd(), "static") to the dict. After a few minutes, if I reload the app, it just load a blank page. If I comment "static_path": os.path.join(os.getcwd(), "static") and re-run the app locally, it works again.
UPDATE: It seems to working fine now locally (no idea why how it fixed itself though). However, I can’t manage to download the test file I put in the static folder after uploading the app on Heroku. I use https://appname.herokuapp.com:80/static/testfile and I get a ERR_SSL_PROTOCOL_ERROR error message after a few seconds.
I can confirm that changing that line in the Server.py file causes Streamlit to just load a blank page, and commenting it out causes it work fine again. I was working in Python3.7.4 on Catalina 10.15.
Hey @jamestjw - just making sure you saw that there are two lines that need changing: a line to add the config option to TORNADO_SETTINGS, and also a line to import os.
(If you’re still seeing a blank page after that, could you paste the Streamlit output from your terminal?)
Well, that’s just it, there is no visible error message or anything. I’m a little unsure what’s going on here, but as soon as I comment out that line in the TORNADO_SETTINGS, things start working again. And yes I also imported os.
Quick update: Blank page situation happens on safari, but not in Chrome. However, when I use the network URL instead of the local URL, the problem occurs on all browsers.
I am trying out this as well, and I am finding the same problem. I am able to download a static file, but the page just stays blank. By looking at the network tab it seems that all assets that were being fetched on static originally returns 404. Likely, the new setting is conflicting.
I am going to do some debug on this and see what I can find…
Unsure your address is correct, but what I mean, you don’t have to add custom_static. You can change this behavior by changing line 26 of my patch. You need to change the matching regex that is the first element of the tuple on that line.
Interesting, I am not a Heroku expert, but here is what I can see from quickly looking at the app you published:
This link http://localhost:8501/text will not work because it is referring to localhost which is your local machine.
About your second link. There might be a problem is with /:8501. You are publishing your app on port 80, so no need to give it the Streamlit port number. Heroku will transalte that for you. Also, you should not be using the / before the port number in any case. I would say this should work: http://trpl-fit-tool.herokuapp.com/text, but when I try it in my browser it does not. There might be an extra configuration step on the Heroku side that is needed. Can you also double check you have deployed the text file in your Heroku container and that is in the right directory?
Note that I also haven’t used https here. Not sure how you have configured that, but I am not sure there is some extra step in configuring Heroku to get it to work with https. You can try both version in any case.
According to the Heroku docs, https is activated by default so you can access the app with https://trpl-fit-tool.herokuapp.com/. The file is definitely on the server, however, I have no idea how to configurate the server so that the file can be dowloaded.
Hi @Emmanuel_Pean, unfortunately that’s about the extent of my knowledge of Heroku, but if anyone in the community wants to weigh in we’d love that. Also, it won’t be ready until early next year but deploying apps through Streamlit is going to be a component of our For Teams offering. If you’d like to sign up for more information here is a link: https://streamlit.io/forteams/
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
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.
Performance cookies
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.
Functional cookies
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.
Targeting cookies
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.