danidanidani commited on
Commit
120b6cd
·
1 Parent(s): 583938d

Fix agraph duplicate widget: remove key param (unsupported), use hidden HTML marker

Browse files
requirements.txt CHANGED
@@ -69,7 +69,7 @@ soupsieve==2.4.1
69
  SQLAlchemy>=2.0.17
70
  st-annotated-text==4.0.0
71
  streamlit==1.23.1
72
- streamlit-agraph==0.0.45
73
  streamlit-camera-input-live==0.2.0
74
  streamlit-card==0.0.5
75
  streamlit-chat==0.1.1
 
69
  SQLAlchemy>=2.0.17
70
  st-annotated-text==4.0.0
71
  streamlit==1.23.1
72
+ streamlit-agraph>=0.0.45
73
  streamlit-camera-input-live==0.2.0
74
  streamlit-card==0.0.5
75
  streamlit-chat==0.1.1
src/frontend/visualizations.py CHANGED
@@ -382,6 +382,7 @@ def plot_compatibility_with_agraph(plants, compatibility_matrix, is_mini=False,
382
  # Render the custom legend using Plotly in Streamlit
383
  st.plotly_chart(legend_fig, use_container_width=True)
384
 
385
- # Render the graph using streamlit-agraph with unique key
386
- graph_key = f"agraph_{key_suffix}_{hash(tuple(sorted(plants)))}"
387
- return_value = agraph(nodes=nodes, edges=edges, config=config, key=graph_key)
 
 
382
  # Render the custom legend using Plotly in Streamlit
383
  st.plotly_chart(legend_fig, use_container_width=True)
384
 
385
+ # Render the graph using streamlit-agraph
386
+ # Add unique markdown to force different widget IDs
387
+ st.markdown(f"<!-- graph_{key_suffix} -->", unsafe_allow_html=True)
388
+ return_value = agraph(nodes=nodes, edges=edges, config=config)