Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page reloading continuously when st_canvas function is called. #137

Open
sciprashanth96 opened this issue Aug 2, 2023 · 2 comments
Open

Comments

@sciprashanth96
Copy link

sciprashanth96 commented Aug 2, 2023

Page keeps reloading automatically and randomly stops after 5-15 reloads whevenver st_canvas is called.

streamlit version: 1.25.0 (Tried 1.20.0, 1.23.0, 1.24.0 also does the same)
streamlit-drawable-canvas version - 0.9.0 (tried with 0.7.0, 0.9.2 and 0.9.3 also. same problem)

This is highly crucial for our project

Trying to convert my plotly figure into an image and annotate on it

image = pio.to_image(fig)
img = Image.open(io.BytesIO(image))
cols = st.columns([4,1])
with cols[0]:
    tabs = st.tabs(['Plotly','Canvas'])
    with tabs[0]:
        plot_controls = st.container()
        with plot_controls:
            # Add config to fig
            config = ['drawline','drawopenpath','drawclosedpath','drawcircle','drawrect','eraseshape']
            fig.update_layout(modebar_add=config,height = 800,width = 800)
            st.plotly_chart(fig, use_container_width=True)    
        with tabs[1]:
            st_canvas(background_image = img)
            print('Canvas')
            uploaded_image = st.file_uploader('Upload Image',type=['png','jpg','jpeg'],key='uploaded_image'+function_code)
@irumata
Copy link

irumata commented Sep 24, 2023

I've found the rootcasue of this problem for my side: the the problem is in empty container. If you have an empty container anywhere on the website this canvas wouldn't work

@oneil512
Copy link

Any progress on this? Very annoying issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants