How can I create a app to explore the images in a folder?

How can I create a app to explore the images in a folder at a server? Display an image at once and use two buttons to switch to display next image or last image.

1 Like

Something like this…

from PIL import Image
import glob


images = glob.glob("/path/to/images/")
index= st.number_input('Index')

if st.button('Next'):
    index+=1


if st.button('Prev'):
    if index > 0
        index = index -1

image = Image.open(images[index])
st.image(image, use_column_width=True)
4 Likes