TestSibernetic / app.py
pgleeson's picture
Tweaks...
005501c
Raw
History Blame Contribute Delete
1.44 kB
import streamlit as st
import stpyvista.utils
from stpyvista import stpyvista as spv
if "IS_XVFB_RUNNING" not in st.session_state:
stpyvista.utils.start_xvfb()
st.session_state.IS_XVFB_RUNNING = True
st.set_page_config(layout="wide")
st.title("Sibernetic simple example")
import pyvista as pv
import numpy as np
import time
from load import load_points
from load import create_plotter
from load import create_mesh
filename = "position_buffer.txt"
if "step" not in st.session_state:
st.session_state.step = 3
if "all_points" not in st.session_state:
st.session_state.all_points, st.session_state.all_point_types = load_points(
filename
)
if "plotter" not in st.session_state:
print("Creating a new plotter...")
st.session_state.plotter = create_plotter()
global plotter
plotter = st.session_state.plotter
last_mesh = None
create_mesh(st.session_state.step, plotter)
max_time = len(st.session_state.all_points) - 1
# pl.add_slider_widget(create_mesh, rng=[0,max_time], value=max_time, title='Time point')
# pl.add_timer_event( max_steps=len(all_points), duration=200, callback=create_mesh)
print("Ready to replay...")
st.session_state.step += 1
st.write("Step: %s" % st.session_state.step)
if st.button("Step"):
if st.session_state.step <= len(st.session_state.all_points):
st.write("Stepped...")
st.session_state.step += 5
spv(plotter, "sibernetic")