I create cv inference app and want to add clear screen button. Images are uploaded through input. So, as I understood, I need to clean input’s uploaded files and screen from inference widgets. I seemingly implemented cleaning input using:
if not 'uploaded_files' in session:
session.uploaded_files = str(uuid.uuid4())
if st.sidebar.button('Clean screen'):
session.uploaded_files = str(uuid.uuid4())
uploaded_files = st.file_uploader('Select files', key=session.uploaded_files,
accept_multiple_files=True)
But I can’t find out how to clean screen from widgets.
Could you be a bit more specific about the behavior you’re looking for, and what you’ve tried so far?
One general idea is to use st.session_state to keep track of which widgets should be shown on the screen, and when you click a button you can update the session state and use st.experimental_rerun to rerender the app with the new widgets shown/hidden.
I’m sorry, it’s not entirely clear to me what exactly you are expecting that script to do. Could you give a complete simplified script that you expect to work, including how you plan to add widgets?