Spaces:
Sleeping
Sleeping
File size: 3,063 Bytes
cead143 89b2b74 79d2b6a 6e8c858 89b2b74 6e8c858 89b2b74 6e8c858 89b2b74 |
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 |
import streamlit as st
import numpy as np
import pandas as pd
import time
# ์ฌ์ด๋๋ฐ ํ์ดํ
st.sidebar.title("์ ์ด์ ๋ฉ๋ด")
# ๋ฉ๋ด ํญ๋ชฉ๊ณผ ํ์ ํญ๋ชฉ ์ ์
menus = {
"Display": ["Display text", "Display interactive widgets", "Display data", "Display media", "Display code", "Display progress and status"],
"B": ["Connect to data sources", "Mutate data", "Placeholders, help, and options"],
"C": ["Optimize performance", "Cache global resources", "Deprecated caching"],
"D": ["Columns", "Tabs", "Control flow"],
"E": ["Build chat-based apps", "Personalize apps for users"],
}
# ๊ฐ ๋ฉ๋ด์ ๋ํด ์ฌ์ด๋๋ฐ์ ์ ์ด์ ๋ฉ๋ด ์์ฑ
for menu in menus:
with st.sidebar.expander(menu):
for sub_menu in menus[menu]:
if st.button(sub_menu, key=sub_menu): # ๊ณ ์ ํ key๋ฅผ ์ ๊ณตํ์ฌ ๊ฐ ๋ฒํผ์ ๊ตฌ๋ณ
selected_menu = sub_menu
break
# ์ ํ๋ ๋ฉ๋ด์ ๋ฐ๋ฅธ ๋์ ๊ตฌํ
if 'selected_menu' in locals():
if selected_menu == "Display text":
st.text('Fixed width text')
st.markdown('_Markdown_') # see #*
st.caption('Balloons. Hundreds of them...')
st.latex(r''' e^{i\pi} + 1 = 0 ''')
st.write('Most objects') # df, err, func, keras!
st.write(['st', 'is <', 3]) # see *
st.title('My title')
st.header('My header')
st.subheader('My sub')
st.code('for i in range(8): foo()')
elif selected_menu == "Display interactive widgets":
if st.button('Hit me'):
st.write('Button clicked!')
data = {'first_col': [1, 2, 3, 4], 'second_col': [10, 20, 30, 40]}
df = pd.DataFrame(data)
# st.data_editor('Edit data', df) # 'st.data_editor' does not exist in Streamlit's current version.
st.checkbox('Check me out')
st.radio('Pick one:', ['nose', 'ear'])
st.selectbox('Select', [1, 2, 3])
st.multiselect('Multiselect', [1, 2, 3])
st.slider('Slide me', min_value=0, max_value=10)
st.select_slider('Slide to select', options=[1, '2'])
st.text_input('Enter some text')
st.number_input('Enter a number')
st.text_area('Area for textual entry')
st.date_input('Date input')
st.time_input('Time entry')
# st.file_uploader('File uploader') # Example does not provide data for 'st.audio', 'st.video', 'st.download_button', etc.
# st.download_button('On the dl', data) # Example does not provide data for this function.
# st.camera_input("ไธไบไธ,่ๅญ!") # 'st.camera_input' does not exist in Streamlit's current version.
st.color_picker('Pick a color')
# The rest of the elif blocks for other sub-menus would be similar to above,
# implementing the functionality as per the chosen sub-menu item.
# Note: Some of the example commands provided do not match with actual Streamlit API functions
# or require context that's not provided, and thus have been commented out or slightly modified.
|