streamlit4c / app.py
seawolf2357's picture
Update app.py
89b2b74 verified
raw
history blame
3.06 kB
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.