streamlit4c / app.py
seawolf2357's picture
Update app.py
4e604e3 verified
raw
history blame
2.46 kB
import streamlit as st
# νŽ˜μ΄μ§€ μ„€μ •
st.set_page_config(layout="wide")
# μ‚¬μ΄λ“œλ°” 타이틀 μ„€μ •
st.sidebar.title("ViDraft")
# 'Home' λ²„νŠΌμ„ μ‚¬μ΄λ“œλ°”μ— μΆ”κ°€
if st.sidebar.button('Home'):
selected_menu = 'Home'
selected_sub_menu = None
else:
selected_menu = None
selected_sub_menu = None
# 메뉴 ν•­λͺ©κ³Ό ν•˜μœ„ ν•­λͺ© μ •μ˜, '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():
with st.sidebar.expander(menu_name):
# ν•˜λΆ€ 메뉴λ₯Ό 선택할 수 μžˆλŠ” selectbox 생성
selected = st.selectbox(f"Select {menu_name} option", [""] + sub_menus, key=menu_name)
if selected:
selected_menu = menu_name
selected_sub_menu = selected
# μ„ νƒλœ 메뉴와 ν•˜λΆ€ 메뉴에 λ”°λ₯Έ λ‚΄μš© ν‘œμ‹œ
if selected_menu and selected_sub_menu:
st.subheader(f"{selected_menu} > {selected_sub_menu}")
# 여기에 μ„ νƒλœ 메뉴에 λ”°λ₯Έ μ½˜ν…μΈ  ν‘œμ‹œ 둜직 μΆ”κ°€
# 'Home' 메뉴가 μ„ νƒλ˜μ—ˆμ„ λ•Œ λ˜λŠ” 앱이 초기 μƒνƒœμΌ λ•Œ 화면에 "ViDraft" 좜λ ₯
if selected_menu == 'Home' or (selected_menu is None and selected_sub_menu is None):
st.title("ViDraft")
st.write("Welcome to ViDraft! Your ultimate platform for video editing, image processing, and sound engineering.")
# 'Template Video'κ°€ μ„ νƒλ˜μ—ˆμ„ λ•Œ λΉ„λ””μ˜€ 가러리λ₯Ό ν‘œμ‹œ
if selected_menu == "Free Stock" and selected_sub_menu == "Template Video":
st.subheader("Template Videos")
# λΉ„λ””μ˜€ 파일 경둜 μ„€μ •
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)