forked from tylerjrichards/Streamlit-for-Data-Science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmp.py
127 lines (95 loc) · 2.75 KB
/
tmp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import numpy as np
import pandas as pd
import streamlit as st
st.title("MEGA APP")
st.write("This app exists to test out all the st commands we possibly can in one go")
st.balloons()
st.snow()
st.write("# input tests")
st.text_input("textbox")
st.number_input("number")
st.slider("slider")
st.button("button")
st.checkbox("checkbox")
st.radio("radio", ["cat", "dog"])
st.selectbox("selectbox", ["cat", "dog"])
st.multiselect("multiselect", ["cat", "dog"])
st.select_slider("select slider", ["cat", "dog"])
st.text_area("text area")
st.date_input("date input")
st.time_input("time input")
st.file_uploader("file input")
st.write("file uploader fails with 404 code")
st.color_picker("color picker")
text_contents = """This is some text"""
st.download_button("Download some text", text_contents)
st.camera_input("cam input")
st.write("# text elements")
st.write("st write")
st.markdown("hello markdown")
st.header("hello header")
st.subheader("hello subheader")
st.caption("hello caption")
st.code("a = 1234")
st.text("hello text")
st.latex("\int a x^2 \,dx")
"""
hello magic
"""
st.write("# data display elements")
chart_data = pd.DataFrame(np.random.randn(20, 3), columns=["a", "b", "c"])
st.dataframe(chart_data)
st.table(chart_data)
st.metric("Metric", 42, 2)
st.write("st json")
st.json(chart_data.head().to_dict())
st.write("# chart elements")
st.line_chart(chart_data)
st.area_chart(chart_data)
st.bar_chart(chart_data)
map_df = pd.DataFrame(
np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4], columns=["lat", "lon"]
)
"""
st.map does not work currently
"""
"""
matplotlib, plotly, bokeh, pydeck, graphviz, and vegalite will be available when we turn on the anaconda packages in q4
"""
st.write("# Media elements")
image_nums = np.random.randint(255, size=(144, 144), dtype=np.uint8)
st.write("st image does not work currently")
st.image(image_nums)
fs = 44100
data = np.random.uniform(-1, 1, fs)
st.audio(data)
st.video(data)
st.image(image_nums)
st.write("# layouts and containers")
st.sidebar.write("sidebar test")
a, b = st.columns(2)
with b:
st.write("col check, should be second column")
with a:
st.write("col check, should be first column")
taba, tabb = st.tabs(["tab a", "tab b"])
tabb.write("tab b test")
with st.expander("open to see expander"):
st.write("works!")
c = st.container()
c.write("should write in the container")
a = st.empty()
a.write("should write in the empty block")
st.write("# display progress and status")
st.write("progress bar test")
my_bar = st.progress(0)
for percent_complete in range(100):
my_bar.progress(percent_complete + 1)
with st.spinner("Wait!"):
st.write("hey")
st.error("st error")
st.warning("st warning")
st.info("st info")
st.success("st success")
e = RuntimeError("example of error")
st.exception(e)