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은 현재 이미지 클릭 이벤트를 직접 처리할 수 없으므로, # 비디오 재생을 위한 버튼을 제공합니다.