Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@
import pandas as pd
import streamlit as st


@st.cache_data
def cache_sleep(i: int, seconds: float = 0.1):
sleep(seconds)
return None


# ! Fragments do not trigger a full app rerun, so the fragment will updated after
# ! the entire code is run
# @st.fragment
def render_button():
with st.echo():
st.button("Click me")
with st.spinner("Loading data ..."):
sleep(5)


st.title("Streamlit App Example")

st.write(
Expand All @@ -18,12 +35,11 @@
"""
)

with st.echo():
st.button("Click me")
with st.spinner("Loading data ..."):
sleep(5)
render_button()

st.write(
"This takes a while to load...simulating a heavy computation or IO process. But it works!"
"This takes a while to load...simulating a heavy computation or IO process. "
"But it works!"
)

sleep(2)
Expand Down Expand Up @@ -55,4 +71,4 @@

for i in range(100):
my_bar.progress(i + 1, text=progress_text)
sleep(0.1)
cache_sleep(i)
Loading