Sephfox commited on
Commit
9a99e1b
·
verified ·
1 Parent(s): 6d93a88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -362,8 +362,15 @@ def update_chart():
362
 
363
  chart_placeholder.plotly_chart(st.session_state.fig, use_container_width=True)
364
 
 
 
 
365
  # Main loop
366
  while True:
367
- run_simulation_step()
368
- time.sleep(update_interval)
369
- st.experimental_rerun()
 
 
 
 
 
362
 
363
  chart_placeholder.plotly_chart(st.session_state.fig, use_container_width=True)
364
 
365
+ # Main loop placeholder
366
+ main_placeholder = st.empty()
367
+
368
  # Main loop
369
  while True:
370
+ with main_placeholder.container():
371
+ run_simulation_step()
372
+ time.sleep(update_interval)
373
+
374
+ # Break the loop if the simulation is stopped
375
+ if not st.session_state.running:
376
+ break