seawolf2357 commited on
Commit
70d8d2a
Β·
verified Β·
1 Parent(s): 9803273

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -49
app.py CHANGED
@@ -1,59 +1,44 @@
1
  import streamlit as st
 
2
 
3
- # μ‚¬μ΄λ“œλ°” 타이틀
4
- st.sidebar.title("접이식 메뉴")
5
 
6
  # 메뉴 ν•­λͺ©κ³Ό ν•˜μœ„ ν•­λͺ© μ •μ˜
7
  menus = {
8
- "Display": ["Display text", "Display interactive widgets", "Display data", "Display media", "Display code", "Display progress and status"],
9
- "Data": ["Connect to data sources", "Mutate data", "Placeholders, help, and options"],
10
- "Control": ["Optimize performance", "Cache global resources", "Deprecated caching"],
11
- "Layout": ["Columns", "Tabs", "Control flow"],
12
- "Interactivity": ["Build chat-based apps", "Personalize apps for users"],
13
  }
14
 
 
15
  selected_menu = None
 
16
 
17
- # 각 메뉴에 λŒ€ν•΄ μ‚¬μ΄λ“œλ°”μ— 접이식 메뉴 생성
18
- for menu in menus:
19
- with st.sidebar.expander(menu):
20
- for sub_menu in menus[menu]:
21
- if st.button(sub_menu, key=sub_menu): # κ³ μœ ν•œ keyλ₯Ό μ œκ³΅ν•˜μ—¬ 각 λ²„νŠΌμ„ ꡬ별
22
- selected_menu = sub_menu
23
- break
24
 
25
- # μ„ νƒλœ 메뉴에 λ”°λ₯Έ λ™μž‘ κ΅¬ν˜„
26
- if 'selected_menu' in locals():
27
- if selected_menu == "Display interactive widgets":
28
- # μŠ¬λΌμ΄λ” μœ„μ ―μ„ μ‚¬μš©ν•˜κ³  λ°˜ν™˜ 값을 slider_val λ³€μˆ˜μ— μ €μž₯
29
- slider_val = st.slider('Slide me', min_value=0, max_value=10)
30
- # μ €μž₯된 slider_val λ³€μˆ˜ 값을 μ‚¬μš©ν•˜μ—¬ 좜λ ₯
31
- st.write(f"μŠ¬λΌμ΄λ”μ˜ κ°’: {slider_val}")
32
-
33
- st.text('Fixed width text')
34
- st.markdown('_Markdown_') # see #*
35
- st.caption('Balloons. Hundreds of them...')
36
- st.latex(r''' e^{i\pi} + 1 = 0 ''')
37
- st.write('Most objects') # df, err, func, keras!
38
- st.write(['st', 'is <', 3]) # see *
39
- st.title('My title')
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')
 
1
  import streamlit as st
2
+ import os
3
 
4
+ # μ‚¬μ΄λ“œλ°” 타이틀 μ„€μ •
5
+ st.sidebar.title("ViDraft")
6
 
7
  # 메뉴 ν•­λͺ©κ³Ό ν•˜μœ„ ν•­λͺ© μ •μ˜
8
  menus = {
9
+ "Free Stock": ["Template Video", "Template Image", "Search Video", "Search Image"],
10
+ "Image": ["Generation", "Face ID", "Inpainting", "Remove Background", "Studio"],
11
+ "Video": ["Generation", "Talking Face", "Remove Background", "Studio"],
12
+ "Sound": ["Video SFX", "Video Music", "TTS(Voice)", "Voice Clone", "Image SFX", "Image Music"],
13
+ "Scripts": ["Script"]
14
  }
15
 
16
+ # μ„ νƒλœ 메뉴 ν•­λͺ©μ„ μ €μž₯ν•  λ³€μˆ˜
17
  selected_menu = None
18
+ selected_sub_menu = None
19
 
20
+ # 메뉴 생성
21
+ selected_menu = st.sidebar.selectbox("Menu", list(menus.keys()))
22
+ selected_sub_menu = st.sidebar.selectbox("Sub Menu", menus[selected_menu])
 
 
 
 
23
 
24
+ # 메뉴 선택에 λ”°λ₯Έ λ™μž‘ κ΅¬ν˜„
25
+ if selected_menu == "Free Stock" and selected_sub_menu == "Template Video":
26
+ # λΉ„λ””μ˜€ 파일이 μžˆλŠ” 디렉토리 경둜 μ„€μ •
27
+ video_directory = "/path/to/your/videos" # 경둜λ₯Ό μ‹€μ œ λΉ„λ””μ˜€ 파일이 μžˆλŠ” 경둜둜 λ³€κ²½ν•˜μ„Έμš”.
28
+
29
+ # 디렉토리 λ‚΄μ˜ λͺ¨λ“  파일 λͺ©λ‘μ„ κ°€μ Έμ˜΄
30
+ files = os.listdir(video_directory)
31
+
32
+ # MP4 파일만 필터링
33
+ video_files = [file for file in files if file.endswith(".mp4")]
34
+
35
+ # 각 λΉ„λ””μ˜€ νŒŒμΌμ— λŒ€ν•΄ 슀트림릿 λΉ„λ””μ˜€ μœ„μ ― 생성
36
+ for video_file in video_files:
37
+ # 파일의 전체 경둜 생성
38
+ video_path = os.path.join(video_directory, video_file)
39
+
40
+ # λΉ„λ””μ˜€ 제λͺ©μ„ 좜λ ₯
41
+ st.subheader(video_file)
42
+
43
+ # λΉ„λ””μ˜€ νŒŒμΌμ„ μŠ€νŠΈλ¦Όλ¦Ώμ„ 톡해 ν‘œμ‹œ
44
+ st.video(video_path)