Team Ai
Apppublic

maxtsui/annotate

sourceHugging Facemitupdated 3y agoView on Hugging Face
0likes
test_ui.py32 linesDownload Raw Back to root
1import streamlit as st2if "page" not in st.session_state:3    st.session_state.page = 04 5def nextpage(): st.session_state.page += 16def restart(): st.session_state.page = 07 8placeholder = st.empty()9st.button("Next",on_click=nextpage,disabled=(st.session_state.page > 3))10 11if st.session_state.page == 0:12    # Replace the placeholder with some text:13    placeholder.text(f"Hello, this is page {st.session_state.page}")14 15elif st.session_state.page == 1:16    # Replace the text with a chart:17    placeholder.line_chart({"data": [1, 5, 2, 6]})18 19elif st.session_state.page == 2:20# Replace the chart with several elements:21    with placeholder.container():22        st.write("This is one element")23        st.write("This is another")24        st.metric("Page:", value=st.session_state.page)25 26elif st.session_state.page == 3:27    placeholder.markdown(r"$f(x) = \exp{\left(x^🐈\right)}$")28 29else:30    with placeholder:31        st.write("This is the end")32        st.button("Restart",on_click=restart)