Stopping re running


For the lines of code below, the code rerun everytime I click to get the coordinates, what i want is that once I get an image, I should be able to click on it multiple times and get the coordinates without it re-runing. Should I use session_state for this?

Steps to reproduce

Code snippet:

import matplotlib.pyplot as plt
import random
import streamlit as st
from streamlit_image_coordinates import streamlit_image_coordinates

# radius of the circle
def oo():

    fig= plt.figure(figsize=(3,3))
    plt.title('Customer Groups')
    plt.ylabel('Spending Score')

value = streamlit_image_coordinates('squares.png')


Running the lines of code will show how it functions in a way that developer doesn’t want to.
Expected behavior:

Even the code is run, the user should be able to click and get different coordinates without getting new values and plots due to re running inspite of using caches.

Actual behavior:

The undesired behavior is that it re runs and gets new values.

Also, it shows two images, and it would be good if it displays only one on the cloud app.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.