UI content retains on using multiple sliders/buttons

Hi All, I am creating multipage streamlit ui…
In one page I have the option to upload File only
In another page there are 10 slider buttons. The user should be able to move around the pages… When the user moves from one page to another, the contents of page1 which has 10 sliders are getting copied in the backgroud… is there any way I could get fresh Page when the user toggles between the pages…

The code is as follows:

import app1
import app2
import streamlit as st
    "Page 1": app1,
    "Page 2": app2
selection = st.sidebar.radio("Go to", list(PAGES.keys()))
page = PAGES[selection]


import streamlit as st
def app():
    st.write('Welcome to app1')
    for i in range(10):
        st.slider("Helpful ?", 1, 5, key = str(i))


import streamlit as st
def app():
    st.title('Welcome to App2')
    uploaded_file = st.file_uploader("Upload New File")

When we run 1st time Page looks like below

When clicked on Page 2

If we see above, we can see welcome to Page/App 1 in background

When I click on Page 1 again

Now when I click on Page 2:

It goes on forever!!! how can I get rid of this?

Thank You,

Hi @chait333, welcome to the Streamlit community!! :wave: :partying_face:

I was able to resolve this issue by removing st.empty() from app1.py


Best, :balloon:

Hey Thanks for the response… removing empty helped and also How can I get the values entered in the slidebars? I want to store them locally for future reference.There are 10 sliders and I want to store the result of all the selected values of these sliders.