Spaces:
Sleeping
Sleeping
seawolf2357
commited on
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"]
|