Repeat to upload image

I upload image by st.file_uploader.
1-st time all OK.
2-nd time - error

Error-message - about other code (model of AI), that have not any dependence with this button.
Anyway if i comment this code - i have not error. I dont know why.

code:

        uploaded_file = st.file_uploader(label='label')
        if uploaded_file is not None:
            image_data = uploaded_file.getvalue()
            img = Image.open(io.BytesIO(image_data))
            st.image(img)

Sorry. Problem was in my code.