How to clear and replace an image

Hi!

I have an image displayed, and I want that image to be replaced with another image when a button is pressed. I can get the second image to appear under the first, but I want to swap them out. Is there a way to do this, or can I clear the first image and then display the second?

Hi @bevanny, welcome to the Streamlit community!

This design pattern can be achieved using st.empty:

Best,
Randy