streamlit4c / app.py
seawolf2357's picture
Update app.py
eda5aa3 verified
raw
history blame
1.67 kB
import streamlit as st
# ์‚ฌ์ด๋“œ๋ฐ” ํƒ€์ดํ‹€ ์„ค์ •
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 = st.sidebar.selectbox("Menu", list(menus.keys()))
selected_sub_menu = st.sidebar.selectbox("Sub Menu", menus[selected_menu])
# '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"]
thumbnails = ["thum1.jpg", "thum2.jpg", "thum3.jpg", "thum4.jpg", "thum5.jpg", "thum6.jpg"]
# ๊ฐค๋Ÿฌ๋ฆฌ ํ˜•ํƒœ๋กœ ์ธ๋„ค์ผ ํ‘œ์‹œ
cols = st.columns(3)
for index in range(len(thumbnails)):
with cols[index % 3]:
st.image(thumbnails[index], width=100, caption=f"Video {index+1}")
if st.button(f"Play Video {index+1}", key=f"video{index+1}"):
# ์„ ํƒ๋œ ๋น„๋””์˜ค ์žฌ์ƒ
st.video(video_files[index])
# ์ฐธ๊ณ : Streamlit์€ ํ˜„์žฌ ์ด๋ฏธ์ง€ ํด๋ฆญ ์ด๋ฒคํŠธ๋ฅผ ์ง์ ‘ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์—†์œผ๋ฏ€๋กœ,
# ๋น„๋””์˜ค ์žฌ์ƒ์„ ์œ„ํ•œ ๋ฒ„ํŠผ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.