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 itertools | |
def paginator(label, items, items_per_page=10, on_sidebar=True): | |
"""Lets the user paginate a set of items. | |
Parameters | |
---------- | |
label : str | |
The label to display over the pagination widget. |
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 itertools | |
def paginator(label, items, items_per_page=10, on_sidebar=True): | |
"""Lets the user paginate a set of items. | |
Parameters | |
---------- | |
label : str | |
The label to display over the pagination widget. |
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 numpy as np | |
def paginator(label, items, items_per_page=10, on_sidebar=True): | |
"""Lets the user paginate a set of items. | |
Parameters | |
---------- | |
label : str | |
The label to display over the pagination widget. |
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 | |
DATA_BUCKET = "http://s3-us-west-2.amazonaws.com/streamlit-demo-data/" | |
DATA_URL = DATA_BUCKET + "uber-raw-data-sep14.csv.gz" | |
read_and_cache_csv = st.cache(pd.read_csv) | |
data = read_and_cache_csv(DATA_URL, nrows=100000) | |
st.write('Data', data) |
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 | |
# Reuse this data across runs! | |
read_and_cache_csv = st.cache(pd.read_csv) | |
BUCKET = "https://streamlit-self-driving.s3-us-west-2.amazonaws.com/" | |
data = read_and_cache_csv(BUCKET + "labels.csv.gz", nrows=1000) | |
desired_label = st.selectbox('Filter to:', ['car', 'truck']) | |
st.write(data[data.label == desired_label]) |
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 load_metadata(): | |
DATA_URL = "https://streamlit-self-driving.s3-us-west-2.amazonaws.com/labels.csv.gz" | |
return pd.read_csv(DATA_URL, nrows=1000) | |
@st.cache | |
def create_summary(metadata, summary_type): |
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 | |
with st.echo(): | |
@st.cache(ignore_hash=True) | |
def load_cached(): | |
csv = pd.read_csv("http://s3-us-west-2.amazonaws.com/streamlit-demo-data/uber-raw-data-sep14.csv.gz", nrows=100000) | |
return csv | |
df = load_cached() |
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
# -*- coding: utf-8 -*- | |
# Copyright 2018-2019 Streamlit Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
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 | |
x = st.slider('x', 0, 10) | |
y = st.slider('y', 0, 10) | |
@st.cache | |
def add_to_y(x): | |
return y + x | |
st.show(add_to_y(x)) |