streamlit4c / app.py
seawolf2357's picture
Update app.py
70d8d2a verified
raw
history blame
1.67 kB
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)