This file contains 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 | |
@st.cache | |
def get_data(): | |
return pd.read_csv('https://datahub.io/core/gdp/r/gdp.csv') | |
'# World GDP' |
This file contains 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
javascript:(() => { | |
/* Autohide header */ | |
const header = document.querySelector('.nH.w-asV.aiw'); | |
hide = () => { | |
header.style.transition = 'opacity 300ms 300ms, transform 300ms 300ms'; | |
header.style.opacity = 0; | |
header.style.transform = 'translateY(-50px)'; |
This file contains 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
javascript:(() => { | |
const css = document.createElement('style'); | |
css.innerText = ` | |
/* Change background */ | |
.js-project-header { | |
background: #23527b!important; | |
} | |
.project-columns { | |
background: #23527b!important; |
This file contains 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 time | |
class TimeIt(object): | |
"""Simple timer for profiling Streamlit apps. | |
Usage | |
----- |
This file contains 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
# --- | |
# From https://gist.github.com/tvst/036da038ab3e999a64497f42de966a92 | |
import streamlit.ReportThread as ReportThread | |
from streamlit.server.Server import Server | |
class SessionState(object): | |
def __init__(self, **kwargs): | |
"""A new SessionState object. |
This file contains 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
const MEDIA_TYPE = "video/webm;codecs=vp9,opus" | |
//const MEDIA_TYPE = "video/webm;codecs=h264" | |
const BLOB_TYPE = "video/webm" | |
class ScreenCastRecorder { | |
constructor({ recordAudio }) { | |
this.recordAudio = recordAudio | |
this.inputStream = null |
This file contains 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 threading | |
def is_running_in_streamlit(): | |
thread = threading.current_thread() | |
return type(thread).__module__.startswith('streamlit.') |
This file contains 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.ReportThread as ReportThread | |
from streamlit.server.Server import Server | |
class ThreadSafeSt(): | |
def __init__(self): | |
"""Object that write to a Streamlit app outside the main thread. | |
This object must be created from the main thread, and then passed | |
around to other threads so they can write to the Streamlit app. |
This file contains 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
"""Adds an st.rerun() command to Streamlit. | |
Usage: | |
import streamlit as st | |
import st_rerun_patch | |
# ... | |
st.rerun() |
OlderNewer