File size: 2,506 Bytes
cead143
79d2b6a
970d605
d92242c
cf6dcc7
d92242c
 
 
 
6e8c858
d92242c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75472b3
 
d92242c
75472b3
d92242c
 
970d605
 
d92242c
75472b3
 
d92242c
 
970d605
 
4e604e3
 
 
 
 
 
 
 
 
75472b3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import streamlit as st

# ํŽ˜์ด์ง€ ์„ค์ •
st.set_page_config(page_title="ViDraft", layout="wide")

# ์„ธ์…˜ ์ƒํƒœ ์ดˆ๊ธฐํ™”
if 'selected_menu' not in st.session_state or 'selected_sub_menu' not in st.session_state:
    st.session_state['selected_menu'] = 'Home'
    st.session_state['selected_sub_menu'] = None

# 'Home' ๋ฒ„ํŠผ ํด๋ฆญ ์‹œ ์„ธ์…˜ ์ƒํƒœ๋ฅผ 'Home'์œผ๋กœ ์„ค์ •ํ•˜๋Š” ํ•จ์ˆ˜
def set_home():
    st.session_state['selected_menu'] = 'Home'
    st.session_state['selected_sub_menu'] = None

# ์‚ฌ์ด๋“œ๋ฐ” ํƒ€์ดํ‹€ ์„ค์ • ๋ฐ 'Home' ๋ฒ„ํŠผ ์ถ”๊ฐ€
st.sidebar.title("ViDraft")
st.sidebar.button('Home', on_click=set_home)

# ๋ฉ”๋‰ด ํ•ญ๋ชฉ๊ณผ ํ•˜์œ„ ํ•ญ๋ชฉ ์ •์˜
menus = {
    "Free Stock": ["Template Video", "Template Image", "Search Video", "Search Image"],
    "Image": ["Generation", "Face ID", "Inpainting", "Remove Background", "Studio"],
    "Video": ["Generation", "Talking Face", "Remove Background", "Studio"],
    "Sound": ["Video SFX", "Video Music", "TTS(Voice)", "Voice Clone", "Image SFX", "Image Music"],
    "Scripts": ["Script"]
}

# ๊ฐ ๋ฉ”๋‰ด๋ณ„ ํ•˜๋ถ€ ๋ฉ”๋‰ด๋ฅผ ํŽผ์นจ
for menu_name, sub_menus in menus.items():
    if menu_name != 'Home':  # 'Home'์€ ํ•˜์œ„ ๋ฉ”๋‰ด๊ฐ€ ์—†์œผ๋ฏ€๋กœ ์ œ์™ธ
        with st.sidebar.expander(menu_name):
            # ํ•˜๋ถ€ ๋ฉ”๋‰ด๋ฅผ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋Š” selectbox ์ƒ์„ฑ
            selected = st.selectbox(f"Select {menu_name} option", [""] + sub_menus, key=menu_name, on_change=set_home)
            if selected:
                st.session_state['selected_menu'] = menu_name
                st.session_state['selected_sub_menu'] = selected

# ์„ ํƒ๋œ ๋ฉ”๋‰ด์™€ ํ•˜๋ถ€ ๋ฉ”๋‰ด์— ๋”ฐ๋ฅธ ๋‚ด์šฉ ํ‘œ์‹œ
if st.session_state['selected_menu'] == 'Home':
    st.title("Welcome to ViDraft")
    st.write("This is the Home page. Select an option from the sidebar to get started.")
else:
    st.subheader(f"{st.session_state['selected_menu']} > {st.session_state['selected_sub_menu']}")
    # ์—ฌ๊ธฐ์— ์„ ํƒ๋œ ๋ฉ”๋‰ด์— ๋”ฐ๋ฅธ ์ฝ˜ํ…์ธ  ํ‘œ์‹œ ๋กœ์ง ์ถ”๊ฐ€

    
    # ๋น„๋””์˜ค ํŒŒ์ผ ๊ฒฝ๋กœ ์„ค์ •
    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"]

    # ๊ฐค๋Ÿฌ๋ฆฌ ํ˜•ํƒœ๋กœ ๋น„๋””์˜ค ํ‘œ์‹œ
    cols = st.columns(2)  # 2๊ฐœ์˜ ์—ด๋กœ ๋„“๊ฒŒ ๋ฐฐ์น˜
    for index, video_file in enumerate(video_files):
        with cols[index % 2]:
            st.video(video_file)