Spaces:
Running
Running
import streamlit as st | |
import os | |
# ์ฌ์ด๋๋ฐ ํ์ดํ ์ค์ | |
st.sidebar.title("ViDraft") | |
# ๋ฉ๋ด ํญ๋ชฉ๊ณผ ํ์ ํญ๋ชฉ ์ ์ | |
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"] | |
} | |
# ์ ํ๋ ๋ฉ๋ด ํญ๋ชฉ์ ์ ์ฅํ ๋ณ์ | |
selected_menu = None | |
selected_sub_menu = None | |
# ๋ฉ๋ด ์์ฑ | |
selected_menu = st.sidebar.selectbox("Menu", list(menus.keys())) | |
selected_sub_menu = st.sidebar.selectbox("Sub Menu", menus[selected_menu]) | |
# ๋ฉ๋ด ์ ํ์ ๋ฐ๋ฅธ ๋์ ๊ตฌํ | |
if selected_menu == "Free Stock" and selected_sub_menu == "Template Video": | |
# ๋น๋์ค ํ์ผ์ด ์๋ ๋๋ ํ ๋ฆฌ ๊ฒฝ๋ก ์ค์ | |
video_directory = "/path/to/your/videos" # ๊ฒฝ๋ก๋ฅผ ์ค์ ๋น๋์ค ํ์ผ์ด ์๋ ๊ฒฝ๋ก๋ก ๋ณ๊ฒฝํ์ธ์. | |
# ๋๋ ํ ๋ฆฌ ๋ด์ ๋ชจ๋ ํ์ผ ๋ชฉ๋ก์ ๊ฐ์ ธ์ด | |
files = os.listdir(video_directory) | |
# MP4 ํ์ผ๋ง ํํฐ๋ง | |
video_files = [file for file in files if file.endswith(".mp4")] | |
# ๊ฐ ๋น๋์ค ํ์ผ์ ๋ํด ์คํธ๋ฆผ๋ฆฟ ๋น๋์ค ์์ ฏ ์์ฑ | |
for video_file in video_files: | |
# ํ์ผ์ ์ ์ฒด ๊ฒฝ๋ก ์์ฑ | |
video_path = os.path.join(video_directory, video_file) | |
# ๋น๋์ค ์ ๋ชฉ์ ์ถ๋ ฅ | |
st.subheader(video_file) | |
# ๋น๋์ค ํ์ผ์ ์คํธ๋ฆผ๋ฆฟ์ ํตํด ํ์ | |
st.video(video_path) | |