mjohanes commited on
Commit
60e7d80
·
1 Parent(s): c4c16e7
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -104,17 +104,17 @@ if "img" in st.session_state:
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 and new_coord not in st.session_state.coords_list:
107
- is_close = False
108
  for coord in st.session_state.coords_list:
109
  existing = np.array([coord["x"], coord["y"]])
110
  new = np.array([new_coord["x"], new_coord["y"]])
111
  if np.linalg.norm(existing - new) < 10:
112
- is_close = True
113
  break
114
- if is_close:
115
  st.session_state.coords_list.remove(coord)
116
  else:
117
  st.session_state.coords_list.append(new_coord)
 
118
  st.rerun()
119
 
120
  st.write("Coordinates:", st.session_state.get("coords"))
 
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 and new_coord not in st.session_state.coords_list:
 
107
  for coord in st.session_state.coords_list:
108
  existing = np.array([coord["x"], coord["y"]])
109
  new = np.array([new_coord["x"], new_coord["y"]])
110
  if np.linalg.norm(existing - new) < 10:
111
+ st.session_state.is_close = True
112
  break
113
+ if st.session_state.is_close:
114
  st.session_state.coords_list.remove(coord)
115
  else:
116
  st.session_state.coords_list.append(new_coord)
117
+ st.session_state.is_close = False
118
  st.rerun()
119
 
120
  st.write("Coordinates:", st.session_state.get("coords"))