Spaces:
Running
Running
seawolf2357
commited on
Commit
β’
c187d44
1
Parent(s):
d92242c
Update app.py
Browse files
app.py
CHANGED
@@ -3,46 +3,39 @@ import streamlit as st
|
|
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 |
-
|
|
|
|
|
|
|
|
|
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": [
|
27 |
}
|
28 |
|
29 |
-
#
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
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
|
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(
|
45 |
-
#
|
|
|
46 |
|
47 |
|
48 |
# λΉλμ€ νμΌ κ²½λ‘ μ€μ
|
|
|
3 |
# νμ΄μ§ μ€μ
|
4 |
st.set_page_config(page_title="ViDraft", layout="wide")
|
5 |
|
6 |
+
# μ¬μ΄λλ° νμ΄ν μ€μ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
st.sidebar.title("ViDraft")
|
|
|
8 |
|
9 |
+
# λΌλμ€ λ²νΌμΌλ‘ λ©λ΄ νλͺ© μ μ
|
10 |
+
menu_items = ["Home", "Free Stock", "Image", "Video", "Sound", "Scripts"]
|
11 |
+
selected_menu = st.sidebar.radio("Menu", menu_items)
|
12 |
+
|
13 |
+
# λ©λ΄μ λ°λ₯Έ νμ λ©λ΄ νλͺ© μ μ
|
14 |
+
sub_menus = {
|
15 |
"Free Stock": ["Template Video", "Template Image", "Search Video", "Search Image"],
|
16 |
"Image": ["Generation", "Face ID", "Inpainting", "Remove Background", "Studio"],
|
17 |
"Video": ["Generation", "Talking Face", "Remove Background", "Studio"],
|
18 |
"Sound": ["Video SFX", "Video Music", "TTS(Voice)", "Voice Clone", "Image SFX", "Image Music"],
|
19 |
+
"Scripts": [] # μμ: 'Scripts'μλ νμ λ©λ΄κ° μλ€κ³ κ°μ
|
20 |
}
|
21 |
|
22 |
+
# μ νλ λ©λ΄μ λ°λ₯Έ νμ λ©λ΄ νμ
|
23 |
+
if selected_menu in sub_menus and sub_menus[selected_menu]:
|
24 |
+
selected_sub_menu = st.sidebar.selectbox("Select option", [""] + sub_menus[selected_menu])
|
25 |
+
else:
|
26 |
+
selected_sub_menu = None
|
|
|
|
|
|
|
|
|
27 |
|
28 |
# μ νλ λ©λ΄μ νλΆ λ©λ΄μ λ°λ₯Έ λ΄μ© νμ
|
29 |
+
if selected_menu == "Home":
|
30 |
st.title("Welcome to ViDraft")
|
31 |
st.write("This is the Home page. Select an option from the sidebar to get started.")
|
32 |
+
elif selected_sub_menu:
|
33 |
+
st.subheader(f"{selected_menu} > {selected_sub_menu}")
|
34 |
+
# μ¬κΈ°μ μ νλ νμ λ©λ΄μ λ°λ₯Έ μ½ν
μΈ νμ λ‘μ§ μΆκ°
|
35 |
else:
|
36 |
+
st.subheader(selected_menu)
|
37 |
+
# μ νλ λ©λ΄μ λ°λ₯Έ μ½ν
μΈ νμ λ‘μ§ μΆκ°
|
38 |
+
|
39 |
|
40 |
|
41 |
# λΉλμ€ νμΌ κ²½λ‘ μ€μ
|