How to Clear uploaded images when using st.file_uploader, accepting multiple files and how to clear other outputs?

I have used file_uploader with multiple accepting multiple images for textual classification. However, I would like for the uploaded images and other results to clear out to allow for another upload trial on my streamlit app. Image bellow shows the results.

How can I achieve that?
Thank you in advance.

1 Like

The easiest way to clear an input value like this is to put it in a st.form with clear_on_submit=True

Thank you for your replay, can you kindly provide a modification to the follow:

I sill get an error:
" ```
IndentationError: unexpected indent

@kenanmorani Could you please post that code as text, rather than a screenshot? That will make it much easier for forum members to help you debug it. See this post for more tips on making a good forum post.

Just eyeballing it, it looks like you may have two issues:

  1. You may have a single space before the if uploaded files...
  2. st.form_submit_button shouldn’t have any values passed to it, just st.form_submit_button()