User wise query counts in streamlit

I have created a simple app in streamlit which take user queries and give sentiment. I want to show the user how many queries they have typed. Is there any way to do this in streamlit

Hi @Vedant_BAIRAGI, and welcome to our community! :slight_smile:

Can you detail what you mean by “user wise query counts?”

Any info, error logs, and code snippets you could provide would help in giving you accurate advice.

Best,
Charly

Hello @Charly_Wargnier,
I want to show each user how many queries has been typed by them.
Say user1 have typed 10 queries, user2 20 queries. Then I want to show a counter on the streamlit app which will be different for each user

Yes, you should be able to do that with st.experimental_user - Streamlit Docs if you are deploying your app on Community Cloud and these are logged-in users. Otherwise, you will need to handle tracking the user some other way (e.g. having them log in, or at least put in their username).

If you need the counts to persist for longer than a session, you’ll want to use some sort of database to record the data for each user Connect to data sources - Streamlit Docs

1 Like

Thank you for response @blackary. I will try to solve the issue by referring the given links

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.