Good day, Im enjoying a lot Streamlink, congratulations for such a great product.
My question is the following:
I created an app with streamlit and dockerized it, and deployed it on a server, all good.
The app makes segmentation of images and generates an output image which I display on screen as a jpeg with st.image. However I also need people to download a png version of the image (with transparency) and for that I want to create a button or a link. I know how to do that, it´s not a problem. The issue is that because it´s a dockerized app, the images that I´m writing with cv2.imwrite (opencv) are written inside the docker container and are also mapped to a folder in the server that is outside of the domain area. So I´m trying to understand how to get a download to the user of the browser from this dockerized app.
Thank you for any tips, advice
something I found now is that if I do:
st.image(image2, caption=‘Transformed Image…’, channels=‘RGB’, format=‘PNG’, use_column_width=True)
then I can download the PNG doing right click on the image, but the filename of the downloaded image is: 332466bfad00ed7b65c58dba759362487e25605697ec8ab15735ef7f.png
How can I control what the filename of the downloaded image will be?
and how can I get this url somehow to also create a button or link for people to download it (as many people won´t do right click over the image to download it)
To set the name of your file, you can set the download argument, as shown in this post:
As far as setting a button or similar, it’s a similar concept to here. If you have the HTML for a button, you can make it an f-string in Python, substituting in your values, then use st.markdown to render the button.
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.