seawolf2357 commited on
Commit
89b2b74
ยท
verified ยท
1 Parent(s): 6e8c858

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -13
app.py CHANGED
@@ -1,29 +1,66 @@
1
  import streamlit as st
 
 
 
2
 
3
  # ์‚ฌ์ด๋“œ๋ฐ” ํƒ€์ดํ‹€
4
  st.sidebar.title("์ ‘์ด์‹ ๋ฉ”๋‰ด")
5
 
6
  # ๋ฉ”๋‰ด ํ•ญ๋ชฉ๊ณผ ํ•˜์œ„ ํ•ญ๋ชฉ ์ •์˜
7
  menus = {
8
- "A": ["A-1", "A-2", "A-3"],
9
- "B": ["B-1", "B-2", "B-3"],
10
- "C": ["C-1", "C-2", "C-3"],
11
- "D": ["D-1", "D-2", "D-3"],
12
- "E": ["E-1", "E-2", "E-3"],
13
  }
14
 
15
- # ์„ ํƒ๋œ ๋ฉ”๋‰ด๋ช…์„ ์ €์žฅํ•  ๋ณ€์ˆ˜
16
- selected_menu = None
17
-
18
  # ๊ฐ ๋ฉ”๋‰ด์— ๋Œ€ํ•ด ์‚ฌ์ด๋“œ๋ฐ”์— ์ ‘์ด์‹ ๋ฉ”๋‰ด ์ƒ์„ฑ
19
  for menu in menus:
20
  with st.sidebar.expander(menu):
21
  for sub_menu in menus[menu]:
22
  if st.button(sub_menu, key=sub_menu): # ๊ณ ์œ ํ•œ key๋ฅผ ์ œ๊ณตํ•˜์—ฌ ๊ฐ ๋ฒ„ํŠผ์„ ๊ตฌ๋ณ„
23
  selected_menu = sub_menu
 
24
 
25
- # ์„ ํƒ๋œ ๋ฉ”๋‰ด๋ช… ์ถœ๋ ฅ
26
- if selected_menu:
27
- st.write(f"์„ ํƒ๋œ ๋ฉ”๋‰ด: {selected_menu}")
28
- else:
29
- st.write("๋ฉ”๋‰ด๋ฅผ ์„ ํƒํ•ด์ฃผ์„ธ์š”.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import numpy as np
3
+ import pandas as pd
4
+ import time
5
 
6
  # ์‚ฌ์ด๋“œ๋ฐ” ํƒ€์ดํ‹€
7
  st.sidebar.title("์ ‘์ด์‹ ๋ฉ”๋‰ด")
8
 
9
  # ๋ฉ”๋‰ด ํ•ญ๋ชฉ๊ณผ ํ•˜์œ„ ํ•ญ๋ชฉ ์ •์˜
10
  menus = {
11
+ "Display": ["Display text", "Display interactive widgets", "Display data", "Display media", "Display code", "Display progress and status"],
12
+ "B": ["Connect to data sources", "Mutate data", "Placeholders, help, and options"],
13
+ "C": ["Optimize performance", "Cache global resources", "Deprecated caching"],
14
+ "D": ["Columns", "Tabs", "Control flow"],
15
+ "E": ["Build chat-based apps", "Personalize apps for users"],
16
  }
17
 
 
 
 
18
  # ๊ฐ ๋ฉ”๋‰ด์— ๋Œ€ํ•ด ์‚ฌ์ด๋“œ๋ฐ”์— ์ ‘์ด์‹ ๋ฉ”๋‰ด ์ƒ์„ฑ
19
  for menu in menus:
20
  with st.sidebar.expander(menu):
21
  for sub_menu in menus[menu]:
22
  if st.button(sub_menu, key=sub_menu): # ๊ณ ์œ ํ•œ key๋ฅผ ์ œ๊ณตํ•˜์—ฌ ๊ฐ ๋ฒ„ํŠผ์„ ๊ตฌ๋ณ„
23
  selected_menu = sub_menu
24
+ break
25
 
26
+ # ์„ ํƒ๋œ ๋ฉ”๋‰ด์— ๋”ฐ๋ฅธ ๋™์ž‘ ๊ตฌํ˜„
27
+ if 'selected_menu' in locals():
28
+ if selected_menu == "Display text":
29
+ st.text('Fixed width text')
30
+ st.markdown('_Markdown_') # see #*
31
+ st.caption('Balloons. Hundreds of them...')
32
+ st.latex(r''' e^{i\pi} + 1 = 0 ''')
33
+ st.write('Most objects') # df, err, func, keras!
34
+ st.write(['st', 'is <', 3]) # see *
35
+ st.title('My title')
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
+ if st.button('Hit me'):
42
+ st.write('Button clicked!')
43
+ data = {'first_col': [1, 2, 3, 4], 'second_col': [10, 20, 30, 40]}
44
+ df = pd.DataFrame(data)
45
+ # st.data_editor('Edit data', df) # 'st.data_editor' does not exist in Streamlit's current version.
46
+ st.checkbox('Check me out')
47
+ st.radio('Pick one:', ['nose', 'ear'])
48
+ st.selectbox('Select', [1, 2, 3])
49
+ st.multiselect('Multiselect', [1, 2, 3])
50
+ st.slider('Slide me', min_value=0, max_value=10)
51
+ st.select_slider('Slide to select', options=[1, '2'])
52
+ st.text_input('Enter some text')
53
+ st.number_input('Enter a number')
54
+ st.text_area('Area for textual entry')
55
+ st.date_input('Date input')
56
+ st.time_input('Time entry')
57
+ # st.file_uploader('File uploader') # Example does not provide data for 'st.audio', 'st.video', 'st.download_button', etc.
58
+ # st.download_button('On the dl', data) # Example does not provide data for this function.
59
+ # st.camera_input("ไธ€ไบŒไธ‰,่Œ„ๅญ!") # 'st.camera_input' does not exist in Streamlit's current version.
60
+ st.color_picker('Pick a color')
61
+
62
+ # The rest of the elif blocks for other sub-menus would be similar to above,
63
+ # implementing the functionality as per the chosen sub-menu item.
64
+
65
+ # Note: Some of the example commands provided do not match with actual Streamlit API functions
66
+ # or require context that's not provided, and thus have been commented out or slightly modified.