Skip to content

Instantly share code, notes, and snippets.

@tvst
tvst / SessionState.py
Last active April 14, 2024 20:24
DO NOT USE!!! Try st.session_state instead.
"""Hack to add per-session state to Streamlit.
Usage
-----
>>> import SessionState
>>>
>>> session_state = SessionState.get(user_name='', favorite_color='black')
>>> session_state.user_name
''
@FranzDiebold
FranzDiebold / SessionState.py
Last active August 25, 2023 14:38 — forked from tvst/SessionState.py
A possible design for doing per-session persistent state in Streamlit
# https://gist.github.com/FranzDiebold/898396a6be785d9b5ca6f3706ef9b0bc
"""Hack to add per-session state to Streamlit.
Works for Streamlit >= v0.65
Usage
-----
>>> import SessionState
>>>
@ash2shukla
ash2shukla / ex.py
Created October 1, 2020 21:35
Streamlit bokeh events example
import streamlit as st
from bokeh.models import ColumnDataSource, CustomJS
from bokeh.plotting import figure
import pandas as pd
import numpy as np
from streamlit_bokeh_events import streamlit_bokeh_events
from state import provide_state
@provide_state
def main(state):