import streamlit as st # 페이지 설정 st.set_page_config(page_title="ViDraft", layout="wide") # 사이드바 타이틀 설정 및 메뉴 정의 st.sidebar.title("ViDraft") menu = ["Home", "Free Stock", "Image", "Video", "Sound", "Scripts"] sub_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"], } # 세션 상태 초기화 if 'current_menu' not in st.session_state: st.session_state['current_menu'] = 'Home' if 'current_sub_menu' not in st.session_state: st.session_state['current_sub_menu'] = '' # 메인 메뉴 선택 selected_menu = st.sidebar.selectbox("Menu", menu) st.session_state['current_menu'] = selected_menu # 하위 메뉴 선택 (해당되는 경우) if selected_menu in sub_menus: selected_sub_menu = st.sidebar.selectbox("Sub Menu", [""] + sub_menus[selected_menu]) st.session_state['current_sub_menu'] = selected_sub_menu else: st.session_state['current_sub_menu'] = '' # 'Home' 페이지 표시 if selected_menu == "Home": st.header("Welcome to ViDraft") st.write("Choose an option from the sidebar to get started.") # 'Free Stock' 메뉴 표시 elif selected_menu == "Free Stock": if st.session_state['current_sub_menu'] == "Template Video": st.header("Template Videos") st.write("Explore a variety of video templates.") # 비디오 파일 경로 설정 및 비디오 표시 로직 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) elif st.session_state['current_sub_menu'] == "Template Image": st.header("Template Images") st.write("Find the perfect image template for your project.") elif st.session_state['current_sub_menu'] == "Search Video": st.header("Search Videos") st.write("Search through our extensive video library to find exactly what you need.") elif st.session_state['current_sub_menu'] == "Search Image": st.header("Search Images") st.write("Discover images that fit your project's needs with our powerful search tool.") # 'Image' 메뉴 표시 elif selected_menu == "Image": if st.session_state['current_sub_menu'] == "Generation": st.header("Image Generation") st.write("Generate images using AI.") elif st.session_state['current_sub_menu'] == "Face ID": st.header("Face ID") st.write("Identify and analyze faces in images.") elif st.session_state['current_sub_menu'] == "Inpainting": st.header("Inpainting") st.write("Fill in missing parts of images.") elif st.session_state['current_sub_menu'] == "Remove Background": st.header("Remove Background") st.write("Easily remove backgrounds from images.") elif st.session_state['current_sub_menu'] == "Studio": st.header("Image Studio") st.write("Access a suite of image editing tools.") # 'Video' 메뉴 표시 elif selected_menu == "Video": if st.session_state['current_sub_menu'] == "Generation": st.header("Video Generation") st.write("Create videos with our generation tools.") elif st.session_state['current_sub_menu'] == "Talking Face": st.header("Talking Face Videos") st.write("Generate talking face videos from images.") elif st.session_state['current_sub_menu'] == "Remove Background": st.header("Video Background Removal") st.write("Remove backgrounds from your videos effortlessly.") elif st.session_state['current_sub_menu'] == "Studio": st.header("Video Studio") st.write("Explore our video editing studio for advanced editing.") # 'Sound' 메뉴 표시 elif selected_menu == "Sound": if st.session_state['current_sub_menu'] == "Video SFX": st.header("Video Sound Effects") st.write("Enhance your videos with sound effects.") elif st.session_state['current_sub_menu'] == "Video Music": st.header("Video Music") st.write("Find the perfect music for your video content.") elif st.session_state['current_sub_menu'] == "TTS(Voice)": st.header("Text-to-Speech") st.write("Convert your text into natural-sounding voice.") elif st.session_state['current_sub_menu'] == "Voice Clone": st.header("Voice Cloning") st.write("Clone any voice for your projects.") elif st.session_state['current_sub_menu'] == "Image SFX": st.header("Image Sound Effects") st.write("Add sound effects to your images.") elif st.session_state['current_sub_menu'] == "Image Music": st.header("Image Music") st.write("Associate music tracks with your images.") # 'Scripts' 메뉴는 하위 메뉴가 없으므로 직접 처리 elif selected_menu == "Scripts": st.header("Scripts") st.write("Script writing tools and resources.") # 이 구조를 사용하여 다른 메뉴 및 하위 메뉴에 대한 콘텐츠를 추가할 수 있습니다.