seawolf2357 commited on
Commit
d80d56f
Β·
verified Β·
1 Parent(s): edfc9c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -39
app.py CHANGED
@@ -3,53 +3,49 @@ import streamlit as st
3
  # νŽ˜μ΄μ§€ μ„€μ •
4
  st.set_page_config(page_title="ViDraft", layout="wide")
5
 
6
- # μ‚¬μ΄λ“œλ°” 타이틀 μ„€μ • 및 메뉴 μ •μ˜
7
  st.sidebar.title("ViDraft")
8
- menu = ["Home", "Free Stock", "Image", "Video", "Sound", "Scripts"]
9
- sub_menus = {
 
 
10
  "Free Stock": ["Template Video", "Template Image", "Search Video", "Search Image"],
11
  "Image": ["Generation", "Face ID", "Inpainting", "Remove Background", "Studio"],
12
  "Video": ["Generation", "Talking Face", "Remove Background", "Studio"],
13
- "Sound": ["Video SFX", "Video Music", "TTS(Voice)", "Voice Clone", "Image SFX", "Image Music"],
 
14
  }
15
 
16
- # μ„Έμ…˜ μƒνƒœ μ΄ˆκΈ°ν™”
17
- if 'current_menu' not in st.session_state:
18
- st.session_state['current_menu'] = 'Home'
19
- if 'current_sub_menu' not in st.session_state:
20
- st.session_state['current_sub_menu'] = ''
 
 
 
 
 
 
21
 
22
- # 메인 메뉴 선택
23
- selected_menu = st.sidebar.selectbox("Menu", menu)
24
- st.session_state['current_menu'] = selected_menu
25
 
26
- # ν•˜μœ„ 메뉴 선택 (ν•΄λ‹Ήλ˜λŠ” 경우)
27
- if selected_menu in sub_menus:
28
- selected_sub_menu = st.sidebar.selectbox("Sub Menu", [""] + sub_menus[selected_menu])
29
- st.session_state['current_sub_menu'] = selected_sub_menu
30
- else:
31
- st.session_state['current_sub_menu'] = ''
32
 
33
  # 'Home' νŽ˜μ΄μ§€ ν‘œμ‹œ
34
  if selected_menu == "Home":
35
  st.header("Welcome to ViDraft")
36
  st.write("Choose an option from the sidebar to get started.")
37
-
38
- # 'Free Stock' 메뉴 ν‘œμ‹œ
39
  elif selected_menu == "Free Stock":
 
40
  if st.session_state['current_sub_menu'] == "Template Video":
41
  st.header("Template Videos")
42
  st.write("Explore a variety of video templates.")
43
-
44
  # λΉ„λ””μ˜€ 파일 경둜 μ„€μ • 및 λΉ„λ””μ˜€ ν‘œμ‹œ 둜직
45
  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"]
46
-
47
  # 가러리 ν˜•νƒœλ‘œ λΉ„λ””μ˜€ ν‘œμ‹œ
48
  cols = st.columns(2) # 2개의 μ—΄λ‘œ λ„“κ²Œ 배치
49
  for index, video_file in enumerate(video_files):
50
  with cols[index % 2]:
51
  st.video(video_file)
52
-
53
  elif st.session_state['current_sub_menu'] == "Template Image":
54
  st.header("Template Images")
55
  st.write("Find the perfect image template for your project.")
@@ -59,9 +55,13 @@ elif selected_menu == "Free Stock":
59
  elif st.session_state['current_sub_menu'] == "Search Image":
60
  st.header("Search Images")
61
  st.write("Discover images that fit your project's needs with our powerful search tool.")
 
62
 
 
 
 
63
 
64
- # 'Image' 메뉴 ν‘œμ‹œ
65
  elif selected_menu == "Image":
66
  if st.session_state['current_sub_menu'] == "Generation":
67
  st.header("Image Generation")
@@ -79,7 +79,7 @@ elif selected_menu == "Image":
79
  st.header("Image Studio")
80
  st.write("Access a suite of image editing tools.")
81
 
82
- # 'Video' 메뉴 ν‘œμ‹œ
83
  elif selected_menu == "Video":
84
  if st.session_state['current_sub_menu'] == "Generation":
85
  st.header("Video Generation")
@@ -94,7 +94,7 @@ elif selected_menu == "Video":
94
  st.header("Video Studio")
95
  st.write("Explore our video editing studio for advanced editing.")
96
 
97
- # 'Sound' 메뉴 ν‘œμ‹œ
98
  elif selected_menu == "Sound":
99
  if st.session_state['current_sub_menu'] == "Video SFX":
100
  st.header("Video Sound Effects")
@@ -105,9 +105,6 @@ elif selected_menu == "Sound":
105
  elif st.session_state['current_sub_menu'] == "TTS(Voice)":
106
  st.header("Text-to-Speech")
107
  st.write("Convert your text into natural-sounding voice.")
108
- elif st.session_state['current_sub_menu'] == "Voice Clone":
109
- st.header("Voice Cloning")
110
- st.write("Clone any voice for your projects.")
111
  elif st.session_state['current_sub_menu'] == "Image SFX":
112
  st.header("Image Sound Effects")
113
  st.write("Add sound effects to your images.")
@@ -115,16 +112,7 @@ elif selected_menu == "Sound":
115
  st.header("Image Music")
116
  st.write("Associate music tracks with your images.")
117
 
118
-
119
- # 'Scripts' λ©”λ‰΄λŠ” ν•˜μœ„ 메뉴가 μ—†μœΌλ―€λ‘œ 직접 처리
120
  elif selected_menu == "Scripts":
121
  st.header("Scripts")
122
  st.write("Script writing tools and resources.")
123
-
124
- # 이 ꡬ쑰λ₯Ό μ‚¬μš©ν•˜μ—¬ λ‹€λ₯Έ 메뉴 및 ν•˜μœ„ 메뉴에 λŒ€ν•œ μ½˜ν…μΈ λ₯Ό μΆ”κ°€ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
125
-
126
-
127
-
128
-
129
-
130
-
 
3
  # νŽ˜μ΄μ§€ μ„€μ •
4
  st.set_page_config(page_title="ViDraft", layout="wide")
5
 
6
+ # μ‚¬μ΄λ“œλ°” 타이틀 μ„€μ •
7
  st.sidebar.title("ViDraft")
8
+
9
+ # 메뉴 및 ν•˜μœ„ 메뉴 μ •μ˜
10
+ menus = {
11
+ "Home": [],
12
  "Free Stock": ["Template Video", "Template Image", "Search Video", "Search Image"],
13
  "Image": ["Generation", "Face ID", "Inpainting", "Remove Background", "Studio"],
14
  "Video": ["Generation", "Talking Face", "Remove Background", "Studio"],
15
+ "Sound": ["Video SFX", "Video Music", "TTS(Voice)", "Image SFX", "Image Music"],
16
+ "Scripts": []
17
  }
18
 
19
+ # λͺ¨λ“  메뉴 및 ν•˜μœ„ 메뉴λ₯Ό νŽΌμ³μ„œ 보여주기 μœ„ν•œ 둜직
20
+ for menu_name, sub_menus in menus.items():
21
+ with st.sidebar.expander(menu_name):
22
+ if sub_menus: # ν•˜μœ„ 메뉴가 μžˆλŠ” 경우
23
+ for sub_menu in sub_menus:
24
+ st.button(sub_menu) # ν•˜μœ„ 메뉴 μ΄λ¦„μœΌλ‘œ λ²„νŠΌ 생성
25
+ else:
26
+ st.write("No sub menus") # ν•˜μœ„ 메뉴가 μ—†λŠ” 경우 λ©”μ‹œμ§€ ν‘œμ‹œ
27
+
28
+ # λ³Έλ¬Έμ—μ„œ μ‚¬μš©μžκ°€ μ„ νƒν•œ 메뉴에 λ”°λ₯Έ 컨텐츠λ₯Ό λ³΄μ—¬μ£ΌλŠ” λ‘œμ§μ€ μƒλž΅
29
+
30
 
 
 
 
31
 
 
 
 
 
 
 
32
 
33
  # 'Home' νŽ˜μ΄μ§€ ν‘œμ‹œ
34
  if selected_menu == "Home":
35
  st.header("Welcome to ViDraft")
36
  st.write("Choose an option from the sidebar to get started.")
 
 
37
  elif selected_menu == "Free Stock":
38
+ # 'Free Stock' 메뉴 선택 μ‹œ 처리 둜직
39
  if st.session_state['current_sub_menu'] == "Template Video":
40
  st.header("Template Videos")
41
  st.write("Explore a variety of video templates.")
 
42
  # λΉ„λ””μ˜€ 파일 경둜 μ„€μ • 및 λΉ„λ””μ˜€ ν‘œμ‹œ 둜직
43
  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"]
 
44
  # 가러리 ν˜•νƒœλ‘œ λΉ„λ””μ˜€ ν‘œμ‹œ
45
  cols = st.columns(2) # 2개의 μ—΄λ‘œ λ„“κ²Œ 배치
46
  for index, video_file in enumerate(video_files):
47
  with cols[index % 2]:
48
  st.video(video_file)
 
49
  elif st.session_state['current_sub_menu'] == "Template Image":
50
  st.header("Template Images")
51
  st.write("Find the perfect image template for your project.")
 
55
  elif st.session_state['current_sub_menu'] == "Search Image":
56
  st.header("Search Images")
57
  st.write("Discover images that fit your project's needs with our powerful search tool.")
58
+ # μ΄ν•˜ μ½”λ“œλŠ” μœ„μ™€ λ™μΌν•œ νŒ¨ν„΄μœΌλ‘œ 'Image', 'Video', 'Sound', 'Scripts' 메뉴λ₯Ό μ²˜λ¦¬ν•©λ‹ˆλ‹€.
59
 
60
+ elif st.session_state['current_sub_menu'] == "Search Image":
61
+ st.header("Search Images")
62
+ st.write("Discover images that fit your project's needs with our powerful search tool.")
63
 
64
+ # 'Image' 메뉴 선택 μ‹œ 처리 둜직
65
  elif selected_menu == "Image":
66
  if st.session_state['current_sub_menu'] == "Generation":
67
  st.header("Image Generation")
 
79
  st.header("Image Studio")
80
  st.write("Access a suite of image editing tools.")
81
 
82
+ # 'Video' 메뉴 선택 μ‹œ 처리 둜직
83
  elif selected_menu == "Video":
84
  if st.session_state['current_sub_menu'] == "Generation":
85
  st.header("Video Generation")
 
94
  st.header("Video Studio")
95
  st.write("Explore our video editing studio for advanced editing.")
96
 
97
+ # 'Sound' 메뉴 선택 μ‹œ 처리 둜직
98
  elif selected_menu == "Sound":
99
  if st.session_state['current_sub_menu'] == "Video SFX":
100
  st.header("Video Sound Effects")
 
105
  elif st.session_state['current_sub_menu'] == "TTS(Voice)":
106
  st.header("Text-to-Speech")
107
  st.write("Convert your text into natural-sounding voice.")
 
 
 
108
  elif st.session_state['current_sub_menu'] == "Image SFX":
109
  st.header("Image Sound Effects")
110
  st.write("Add sound effects to your images.")
 
112
  st.header("Image Music")
113
  st.write("Associate music tracks with your images.")
114
 
115
+ # 'Scripts' 메뉴 선택 μ‹œ 처리 둜직
 
116
  elif selected_menu == "Scripts":
117
  st.header("Scripts")
118
  st.write("Script writing tools and resources.")