Spaces:
Running
Running
seawolf2357
commited on
Commit
β’
d92242c
1
Parent(s):
75472b3
Update app.py
Browse files
app.py
CHANGED
@@ -1,51 +1,49 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
# νμ΄μ§ μ€μ
|
4 |
-
st.set_page_config(layout="wide")
|
5 |
|
6 |
-
#
|
7 |
-
st.
|
|
|
|
|
8 |
|
9 |
-
# 'Home' λ²νΌ
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
with st.sidebar.expander(menu_name):
|
31 |
# νλΆ λ©λ΄λ₯Ό μ νν μ μλ selectbox μμ±
|
32 |
-
selected = st.selectbox(f"Select {menu_name} option", [""] + sub_menus, key=menu_name)
|
33 |
if selected:
|
34 |
-
selected_menu = menu_name
|
35 |
-
selected_sub_menu = selected
|
36 |
|
37 |
# μ νλ λ©λ΄μ νλΆ λ©λ΄μ λ°λ₯Έ λ΄μ© νμ
|
38 |
-
if selected_menu ==
|
39 |
st.title("Welcome to ViDraft")
|
40 |
st.write("This is the Home page. Select an option from the sidebar to get started.")
|
41 |
-
|
42 |
-
st.subheader(f"{selected_menu} > {selected_sub_menu}")
|
43 |
# μ¬κΈ°μ μ νλ λ©λ΄μ λ°λ₯Έ μ½ν
μΈ νμ λ‘μ§ μΆκ°
|
44 |
|
45 |
-
# μμ: 'Template Video'κ° μ νλμμ λ λΉλμ€ κ°€λ¬λ¦¬λ₯Ό νμ
|
46 |
-
if selected_menu == "Free Stock" and selected_sub_menu == "Template Video":
|
47 |
-
st.subheader("Template Videos")
|
48 |
-
# λΉλμ€ νμΌ κ²½λ‘ μ€μ λ° λΉλμ€ νμ λ‘μ§ μΆκ°
|
49 |
|
50 |
# λΉλμ€ νμΌ κ²½λ‘ μ€μ
|
51 |
video_files = ["ex1.mp4", "ex2.mp4", "ex3.mp4", "ex4.mp4", "ex5.mp4", "ex6.mp4", "ex7.mp4","ex8.mp4", "ex9.mp4", "ex10.mp4", "ex11.mp4", "ex12.mp4", "ex13.mp4", "ex14.mp4","ex15.mp4", "ex16.mp4", "ex17.mp4", "ex18.mp4"]
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
# νμ΄μ§ μ€μ
|
4 |
+
st.set_page_config(page_title="ViDraft", layout="wide")
|
5 |
|
6 |
+
# μΈμ
μν μ΄κΈ°ν
|
7 |
+
if 'selected_menu' not in st.session_state or 'selected_sub_menu' not in st.session_state:
|
8 |
+
st.session_state['selected_menu'] = 'Home'
|
9 |
+
st.session_state['selected_sub_menu'] = None
|
10 |
|
11 |
+
# 'Home' λ²νΌ ν΄λ¦ μ μΈμ
μνλ₯Ό 'Home'μΌλ‘ μ€μ νλ ν¨μ
|
12 |
+
def set_home():
|
13 |
+
st.session_state['selected_menu'] = 'Home'
|
14 |
+
st.session_state['selected_sub_menu'] = None
|
15 |
+
|
16 |
+
# μ¬μ΄λλ° νμ΄ν μ€μ λ° 'Home' λ²νΌ μΆκ°
|
17 |
+
st.sidebar.title("ViDraft")
|
18 |
+
st.sidebar.button('Home', on_click=set_home)
|
19 |
+
|
20 |
+
# λ©λ΄ νλͺ©κ³Ό νμ νλͺ© μ μ
|
21 |
+
menus = {
|
22 |
+
"Free Stock": ["Template Video", "Template Image", "Search Video", "Search Image"],
|
23 |
+
"Image": ["Generation", "Face ID", "Inpainting", "Remove Background", "Studio"],
|
24 |
+
"Video": ["Generation", "Talking Face", "Remove Background", "Studio"],
|
25 |
+
"Sound": ["Video SFX", "Video Music", "TTS(Voice)", "Voice Clone", "Image SFX", "Image Music"],
|
26 |
+
"Scripts": ["Script"]
|
27 |
+
}
|
28 |
+
|
29 |
+
# κ° λ©λ΄λ³ νλΆ λ©λ΄λ₯Ό νΌμΉ¨
|
30 |
+
for menu_name, sub_menus in menus.items():
|
31 |
+
if menu_name != 'Home': # 'Home'μ νμ λ©λ΄κ° μμΌλ―λ‘ μ μΈ
|
32 |
with st.sidebar.expander(menu_name):
|
33 |
# νλΆ λ©λ΄λ₯Ό μ νν μ μλ selectbox μμ±
|
34 |
+
selected = st.selectbox(f"Select {menu_name} option", [""] + sub_menus, key=menu_name, on_change=set_home)
|
35 |
if selected:
|
36 |
+
st.session_state['selected_menu'] = menu_name
|
37 |
+
st.session_state['selected_sub_menu'] = selected
|
38 |
|
39 |
# μ νλ λ©λ΄μ νλΆ λ©λ΄μ λ°λ₯Έ λ΄μ© νμ
|
40 |
+
if st.session_state['selected_menu'] == 'Home':
|
41 |
st.title("Welcome to ViDraft")
|
42 |
st.write("This is the Home page. Select an option from the sidebar to get started.")
|
43 |
+
else:
|
44 |
+
st.subheader(f"{st.session_state['selected_menu']} > {st.session_state['selected_sub_menu']}")
|
45 |
# μ¬κΈ°μ μ νλ λ©λ΄μ λ°λ₯Έ μ½ν
μΈ νμ λ‘μ§ μΆκ°
|
46 |
|
|
|
|
|
|
|
|
|
47 |
|
48 |
# λΉλμ€ νμΌ κ²½λ‘ μ€μ
|
49 |
video_files = ["ex1.mp4", "ex2.mp4", "ex3.mp4", "ex4.mp4", "ex5.mp4", "ex6.mp4", "ex7.mp4","ex8.mp4", "ex9.mp4", "ex10.mp4", "ex11.mp4", "ex12.mp4", "ex13.mp4", "ex14.mp4","ex15.mp4", "ex16.mp4", "ex17.mp4", "ex18.mp4"]
|