mjohanes commited on
Commit
cfe4f2e
·
1 Parent(s): 27251a9
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -85,6 +85,10 @@ if picture is not None:
85
  st.session_state.img = img # save the processed image
86
  # st.session_state.coords_list = []
87
 
 
 
 
 
88
  if "img" in st.session_state:
89
  img = st.session_state.img
90
 
@@ -100,7 +104,7 @@ if "img" in st.session_state:
100
  draw.ellipse((cx - 5, cy - 5, cx + 5, cy + 5), fill="red")
101
 
102
  # Use the interactive component as the display canvas, showing the image with all dots.
103
- new_coord = streamlit_image_coordinates(img_with_dots, key="click_img")
104
 
105
  # If a new coordinate is received and it's not already in our list, add it and force a rerun.
106
  if new_coord:
 
85
  st.session_state.img = img # save the processed image
86
  # st.session_state.coords_list = []
87
 
88
+ # Ensure we have a widget_key in session state
89
+ if "widget_key" not in st.session_state:
90
+ st.session_state.widget_key = 0
91
+
92
  if "img" in st.session_state:
93
  img = st.session_state.img
94
 
 
104
  draw.ellipse((cx - 5, cy - 5, cx + 5, cy + 5), fill="red")
105
 
106
  # Use the interactive component as the display canvas, showing the image with all dots.
107
+ new_coord = streamlit_image_coordinates(img_with_dots, key=f"click_img_{st.session_state.widget_key}")
108
 
109
  # If a new coordinate is received and it's not already in our list, add it and force a rerun.
110
  if new_coord: