Spaces:
Sleeping
Sleeping
seawolf2357
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -9,12 +9,14 @@ st.sidebar.title("μ μ΄μ λ©λ΄")
|
|
9 |
# λ©λ΄ νλͺ©κ³Ό νμ νλͺ© μ μ
|
10 |
menus = {
|
11 |
"Display": ["Display text", "Display interactive widgets", "Display data", "Display media", "Display code", "Display progress and status"],
|
12 |
-
"
|
13 |
-
"
|
14 |
-
"
|
15 |
-
"
|
16 |
}
|
17 |
|
|
|
|
|
18 |
# κ° λ©λ΄μ λν΄ μ¬μ΄λλ°μ μ μ΄μ λ©λ΄ μμ±
|
19 |
for menu in menus:
|
20 |
with st.sidebar.expander(menu):
|
@@ -24,7 +26,9 @@ for menu in menus:
|
|
24 |
break
|
25 |
|
26 |
# μ νλ λ©λ΄μ λ°λ₯Έ λμ ꡬν
|
27 |
-
if
|
|
|
|
|
28 |
if selected_menu == "Display text":
|
29 |
st.text('Fixed width text')
|
30 |
st.markdown('_Markdown_') # see #*
|
@@ -36,31 +40,93 @@ if 'selected_menu' in locals():
|
|
36 |
st.header('My header')
|
37 |
st.subheader('My sub')
|
38 |
st.code('for i in range(8): foo()')
|
39 |
-
|
40 |
elif selected_menu == "Display interactive widgets":
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
st.
|
47 |
-
st.
|
48 |
-
st.
|
49 |
-
st.
|
50 |
-
st.
|
51 |
-
st.
|
52 |
-
st.
|
53 |
-
st.
|
54 |
-
st.
|
55 |
-
st.
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
# λ©λ΄ νλͺ©κ³Ό νμ νλͺ© μ μ
|
10 |
menus = {
|
11 |
"Display": ["Display text", "Display interactive widgets", "Display data", "Display media", "Display code", "Display progress and status"],
|
12 |
+
"Data": ["Connect to data sources", "Mutate data", "Placeholders, help, and options"],
|
13 |
+
"Control": ["Optimize performance", "Cache global resources", "Deprecated caching"],
|
14 |
+
"Layout": ["Columns", "Tabs", "Control flow"],
|
15 |
+
"Interactivity": ["Build chat-based apps", "Personalize apps for users"],
|
16 |
}
|
17 |
|
18 |
+
selected_menu = None
|
19 |
+
|
20 |
# κ° λ©λ΄μ λν΄ μ¬μ΄λλ°μ μ μ΄μ λ©λ΄ μμ±
|
21 |
for menu in menus:
|
22 |
with st.sidebar.expander(menu):
|
|
|
26 |
break
|
27 |
|
28 |
# μ νλ λ©λ΄μ λ°λ₯Έ λμ ꡬν
|
29 |
+
if selected_menu:
|
30 |
+
st.header(f"Selected Menu: {selected_menu}")
|
31 |
+
|
32 |
if selected_menu == "Display text":
|
33 |
st.text('Fixed width text')
|
34 |
st.markdown('_Markdown_') # see #*
|
|
|
40 |
st.header('My header')
|
41 |
st.subheader('My sub')
|
42 |
st.code('for i in range(8): foo()')
|
43 |
+
|
44 |
elif selected_menu == "Display interactive widgets":
|
45 |
+
# Interactive widgets
|
46 |
+
button_clicked = st.button('Hit me')
|
47 |
+
checkbox_checked = st.checkbox('Check me out')
|
48 |
+
radio_option = st.radio('Pick one:', ['nose', 'ear'])
|
49 |
+
selectbox_option = st.selectbox('Select', [1, 2, 3])
|
50 |
+
multiselect_options = st.multiselect('Multiselect', [1, 2, 3])
|
51 |
+
slider_value = st.slider('Slide me', min_value=0, max_value=10)
|
52 |
+
select_slider_option = st.select_slider('Slide to select', options=[1, '2'])
|
53 |
+
text_input = st.text_input('Enter some text')
|
54 |
+
number_input = st.number_input('Enter a number')
|
55 |
+
text_area = st.text_area('Area for textual entry')
|
56 |
+
date_input = st.date_input('Date input')
|
57 |
+
time_input = st.time_input('Time entry')
|
58 |
+
file_uploader = st.file_uploader('File uploader')
|
59 |
+
color_picker = st.color_picker('Pick a color')
|
60 |
+
|
61 |
+
# μ£Όμ΄μ§ μ½λ μ€ μ€νλμ§ μκ±°λ 컨ν
μ€νΈκ° λλ½λ λΆλΆμ μ£Όμ μ²λ¦¬νκ±°λ μλ΅νμ΅λλ€.
|
62 |
+
# μλ₯Ό λ€μ΄, `data` λ³μκ° μ μλμ§ μμμΌλ―λ‘ `st.audio(data)`, `st.video(data)` λ±μ μ€νν μ μμ΅λλ€.
|
63 |
+
# λν, `st.data_editor`, `st.camera_input` λ±μ Streamlitμ νμ¬ λ²μ μμ μ§μνμ§ μλ κΈ°λ₯μ
λλ€.
|
64 |
+
# 'st.experimental_rerun()'κ³Ό κ°μ μ€νμ κΈ°λ₯μ Streamlitμ νΉμ λ²μ μμλ§ μ¬μ©ν μ μμ΅λλ€.
|
65 |
+
# κ° κΈ°λ₯μ μ¬μ©νκΈ° μ μ Streamlit λ¬Έμλ₯Ό μ°Έκ³ νμ¬ νμ¬ λ²μ μμ μ§μνλμ§ νμΈνμΈμ.
|
66 |
+
|
67 |
+
# κΈ°ν κΈ°λ₯ ꡬνμ μ νλ λ©λ΄μ λ°λΌ μ μ¬ν ν¨ν΄μΌλ‘ μΆκ°ν μ μμ΅λλ€.
|
68 |
+
|
69 |
+
|
70 |
+
st.write(slider_val)
|
71 |
+
st.slider('Pick a number', 0, 100, disabled=True)
|
72 |
+
st.dataframe(my_dataframe)
|
73 |
+
st.table(data.iloc[0:10])
|
74 |
+
st.json({'foo':'bar','fu':'ba'})
|
75 |
+
st.metric(label="Temp", value="273 K", delta="1.2 K")
|
76 |
+
st.image('./header.png')
|
77 |
+
st.audio(data)
|
78 |
+
st.video(data)
|
79 |
+
|
80 |
+
col1, col2 = st.columns(2)
|
81 |
+
col1.write('Column 1')
|
82 |
+
col2.write('Column 2')
|
83 |
+
|
84 |
+
# Three columns with different widths
|
85 |
+
col1, col2, col3 = st.columns([3,1,1])
|
86 |
+
# col1 is wider
|
87 |
+
|
88 |
+
|
89 |
+
# Insert containers separated into tabs:
|
90 |
+
>>> tab1, tab2 = st.tabs(["Tab 1", "Tab2"])
|
91 |
+
>>> tab1.write("this is tab 1")
|
92 |
+
>>> tab2.write("this is tab 2")
|
93 |
+
|
94 |
+
|
95 |
+
# Stop execution immediately:
|
96 |
+
st.stop()
|
97 |
+
# Rerun script immediately:
|
98 |
+
st.experimental_rerun()
|
99 |
+
|
100 |
+
|
101 |
+
st.help(pandas.DataFrame)
|
102 |
+
st.get_option(key)
|
103 |
+
st.set_option(key, value)
|
104 |
+
st.set_page_config(layout='wide')
|
105 |
+
st.experimental_show(objects)
|
106 |
+
st.experimental_get_query_params()
|
107 |
+
st.experimental_set_query_params(**params)
|
108 |
+
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
+
|
113 |
+
with st.spinner(text='In progress'):
|
114 |
+
time.sleep(10)
|
115 |
+
st.success('Done')
|
116 |
+
|
117 |
+
# Show and update progress bar
|
118 |
+
bar = st.progress(50)
|
119 |
+
time.sleep(10)
|
120 |
+
bar.progress(100)
|
121 |
+
|
122 |
+
st.balloons()
|
123 |
+
st.snow()
|
124 |
+
st.toast('Mr Stay-Puft')
|
125 |
+
st.error('Error message')
|
126 |
+
st.warning('Warning message')
|
127 |
+
st.info('Info message')
|
128 |
+
st.success('Success message')
|
129 |
+
st.exception(e)
|
130 |
+
|
131 |
+
|
132 |
+
|