Pagination in streamlit


I’ve developed a small search engine (google style) so when I write the search term in the window the script go and search it in mysql db and display the results, for now I limit the results to 10 but I want to add a pagination functionality and I’m not so sure how to use the session state in that case.

Steps to reproduce

Code snippet:

    term = st.text_input('Enter search words:')
    if term:
        results = search(term) ### that's the function that do the search in the db
        st.caption(f'Number of results: {len(results)}')
        for item in results:

Thanks :slight_smile:

Here’s an example with pagination with images.

Hosted here:

Let me know if you need the example simplified. :slight_smile:

Thanks a lot bro, I think I finally got it lol
it’s pretty much working for me now!