Hi all,
I am developing a concept for an app in my head and I was hoping for a bit of advice on how to approach this. I have used Streamlit for 6 months, mostly for dynamic plotting of data, so I know the basics.
The concept is this:
a) I will have a number of photos stored somewhere (like github). Each photo contains a number of items (cats, dogs, etc).
b) The user opens the streamlit app and a random image is shown. The user is asked how many cats are in this image and they can input this value.
c) Part b) repeats 10 times (i.e. a different image loads with a different number of cats), until there is 10 user inputs.
d) After 10 user inputs, the app calculates the users score and displays results.
I know I can create a place for my images using st.empty() and update the image after each input. That seems like it should be OK.
The thing I am a little confused about is how I can collate the user inputs, since every time the user enters their answer, wont the app reset?
Maybe it is easier than I am thinking, but any advice or help, or things I have not thought of yet, would all be appreciated.
Donât know how much time you have been spending on the forum in the last few months but I think the easiest way to do this is using session state.
You can easily store each of the userâs answers in st.session_state, and then compare them with the âcorrectâ values once they are finished! here are some links for you to get started:
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.