Skip to content

Instantly share code, notes, and snippets.

@okld
okld / st_demo_rerun.py
Last active Jun 26, 2020
Streamlit - Periodic app rerun
View st_demo_rerun.py
import random
import streamlit as st
from streamlit.ReportThread import get_report_ctx
from streamlit.server.Server import Server
from threading import Thread
from time import sleep
def main():
st.line_chart(random.sample(range(100), 20))
@okld
okld / st_demo_settings.py
Last active Nov 25, 2020
Streamlit - Settings page with session state
View st_demo_settings.py
import streamlit as st
from streamlit.hashing import _CodeHasher
try:
# Before Streamlit 0.65
from streamlit.ReportThread import get_report_ctx
from streamlit.server.Server import Server
except ModuleNotFoundError:
# After Streamlit 0.65
from streamlit.report_thread import get_report_ctx
You can’t perform that action at this time.