I am working on building a client-side ML app for image classification for a project. I have a pretrained model in Pytorch and would ideally be predicting the label of every image uploaded purely client-side, meaning no data from the image is sent to the backend. Just started using streamlit for this but I’m still not sure if the solution is completely client-side? When I inspect the ‘Network’ tab of the dev console upon the call to st.file_uploader(), I see an ‘Img’ and ‘Media’ attributes get populated, which would perhaps not happen if the flow was totally client-side.
Wondering if anyone has thoughts? FYI: I implemented a custom component image uploader and it seems to not store data anywhere, the only issue I’m having is with accessing the image uploaded outside of the custom component for further streamlit manipulation…
Glad to be here @randyzwitch. Thoroughly enjoying using Streamlit!
I’m trying to put something together that runs computation/inference solely on the browser (kind of like tensorflow.js). Is this possible with any kind of streamlit configuration, or custom components?
I think it should be doable with a custom component wrapped around ONNX.js, you can load your pytorch model using it on client side and then do the inference on client side.
As part of the component, you’d have to write your own file_uploader component as well, since st.file_uploader sends the data to the Python backend. At that point, not sure Streamlit is providing a whole lot of value once you write that much JavaScript.
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.