mjohanes commited on
Commit
08e68c1
·
1 Parent(s): 33b660d
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -104,7 +104,15 @@ 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
- st.session_state.coords_list.append(new_coord)
 
 
 
 
 
 
 
 
108
  st.rerun()
109
 
110
  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
+ is_close = False
108
+ for coord in st.sesson_state.coords_list:
109
+ if np.linalg.norm(coord, new_coord) < 10:
110
+ is_close = True
111
+ break
112
+ if is_close:
113
+ st.session_state.coords_list.remove(coord)
114
+ else:
115
+ st.session_state.coords_list.append(new_coord)
116
  st.rerun()
117
 
118
  st.write("Coordinates:", st.session_state.get("coords"))