Pagination in streamlit

Summary

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:
             st.write(item["url"])
              

Thanks :slight_smile:

Here’s an example with pagination with images.

Hosted here:
https://mathcatsand-examples.streamlit.app/relabeling_images

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!

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