This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pretty print tables summarizing properties of tensor arrays in numpy, pytorch, jax, etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
import pandas as pd | |
import numpy as np | |
st.write('`Simple form callback demo`') | |
st.subheader('Constraints Solver') | |
state = st.session_state | |
if 'is_modified' not in state: | |
state['is_modified'] = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Builds on my original Pomodoro timer (see pomodoro.py). This has start, stop, pause controls. | |
# It uses callbacks, session_state, status messages and reruns for a better UX | |
# Requires Streamlit, version >= 1.14.0 | |
import streamlit as st | |
import time | |
st.set_page_config( | |
page_title='Pomodoro', | |
layout='centered', | |
page_icon='🍅' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://discuss.streamlit.io/t/how-to-add-a-download-excel-csv-function-to-a-button/4474/16 | |
import streamlit as st # 🎈 streamlit development | |
import pandas as pd | |
import io | |
from itertools import cycle | |
buffer = io.BytesIO() | |
# Create some Pandas dataframes from some data. | |
df_list = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import streamlit as st | |
import pandas as pd | |
st.set_page_config( | |
page_title='Cascade Selection', | |
layout='centered', | |
page_icon='🌴' | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Slightly improved with a couple of js call wrappers to clean code and add async/await boilerplate | |
import streamlit as st | |
# https://github.com/thunderbug1/streamlit-javascript | |
from streamlit_javascript import st_javascript | |
st.header("st_javascript demo") | |
st.write("#### Helper wrappers") | |
with st.echo(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import datetime as dt | |
import requests | |
import mplfinance as mpf | |
import pandas as pd | |
from pandas_datareader import data as pdr | |
import streamlit as st | |
# ----------------------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
# -------------------------------------------------------------------------------- | |
def v_space(n, level=None): | |
for _ in range(n): | |
header_marks = '' | |
if level: | |
header_marks = '#' * int(level) | |
st.write(f'{header_marks} '.strip()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This seems to be a common issue amongst new Streamlit users, so I wrote a mini-tutorial app to explain how widgets | |
# are used with initialized values and how to make them stick using session state and callbacks. | |
# | |
# There are three ways: | |
# | |
# (1) The most basic where the initial value is not given but the widget is always reset, | |
# (2) Where it’s initialized but there are issues getting the return value to stick, and finally | |
# (3) Overcoming all issues with session state and callbacks. | |
# |