Spaces:
Running
Running
seawolf2357
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,49 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
# μ¬μ΄λλ° νμ΄ν μ€μ
|
4 |
st.sidebar.title("ViDraft")
|
5 |
|
6 |
# λ©λ΄ νλͺ©κ³Ό νμ νλͺ© μ μ
|
7 |
menus = {
|
8 |
-
"Free Stock": ["Template Video", "Template Image",
|
9 |
"Image": ["Generation", "Face ID", "Inpainting", "Remove Background", "Studio"],
|
10 |
"Video": ["Generation", "Talking Face", "Remove Background", "Studio"],
|
11 |
-
"Sound": ["Video SFX", "Video Music", "TTS(Voice)", "Voice Clone", "Image SFX",
|
12 |
"Scripts": ["Script"]
|
13 |
}
|
14 |
|
15 |
-
# μ νλ
|
16 |
-
|
17 |
-
selected_sub_menu = None
|
18 |
|
19 |
-
# λ©λ΄ μμ±
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
# 'Template Video'κ° μ νλμμ λ
|
24 |
if selected_menu == "Free Stock" and selected_sub_menu == "Template Video":
|
25 |
-
|
26 |
-
video_path = "example.mp4" # μ€νμ΄μ€μ λ£¨νΈ λλ ν 리μ μμΉν κ²½μ°
|
27 |
|
28 |
-
# λΉλμ€
|
29 |
-
|
|
|
30 |
|
31 |
-
#
|
32 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
import os
|
3 |
|
4 |
# μ¬μ΄λλ° νμ΄ν μ€μ
|
5 |
st.sidebar.title("ViDraft")
|
6 |
|
7 |
# λ©λ΄ νλͺ©κ³Ό νμ νλͺ© μ μ
|
8 |
menus = {
|
9 |
+
"Free Stock": ["Template Video", "Template Image", "Search Video", "Search Image"],
|
10 |
"Image": ["Generation", "Face ID", "Inpainting", "Remove Background", "Studio"],
|
11 |
"Video": ["Generation", "Talking Face", "Remove Background", "Studio"],
|
12 |
+
"Sound": ["Video SFX", "Video Music", "TTS(Voice)", "Voice Clone", "Image SFX", "Image Music"],
|
13 |
"Scripts": ["Script"]
|
14 |
}
|
15 |
|
16 |
+
# μ νλ λΉλμ€λ₯Ό μ μ₯ν λ³μ
|
17 |
+
selected_video = None
|
|
|
18 |
|
19 |
+
# λ©λ΄ μμ± λ° μ μ΄μ λ©λ΄ ꡬν
|
20 |
+
for menu in menus.keys():
|
21 |
+
with st.sidebar.expander(menu):
|
22 |
+
for sub_menu in menus[menu]:
|
23 |
+
if st.button(sub_menu, key=sub_menu):
|
24 |
+
selected_menu = menu
|
25 |
+
selected_sub_menu = sub_menu
|
26 |
+
break
|
27 |
|
28 |
+
# 'Template Video'κ° μ νλμμ λ λΉλμ€ κ°€λ¬λ¦¬λ₯Ό νμ
|
29 |
if selected_menu == "Free Stock" and selected_sub_menu == "Template Video":
|
30 |
+
st.subheader("Template Videos")
|
|
|
31 |
|
32 |
+
# 10κ°μ λΉλμ€ μΈλ€μΌκ³Ό νμΌ κ²½λ‘ μ μ
|
33 |
+
video_paths = [f"example{i}.mp4" for i in range(1, 11)]
|
34 |
+
thumbnail_paths = [f"thumbnail{i}.jpg" for i in range(1, 11)]
|
35 |
|
36 |
+
# μΈλ€μΌμ νμνκ³ μ ν μ²λ¦¬
|
37 |
+
cols = st.columns(5)
|
38 |
+
for index, col in enumerate(cols):
|
39 |
+
with col:
|
40 |
+
if index < len(thumbnail_paths):
|
41 |
+
# μΈλ€μΌ μ΄λ―Έμ§ νμ
|
42 |
+
st.image(thumbnail_paths[index], width=100)
|
43 |
+
# μΈλ€μΌ ν΄λ¦ μ²λ¦¬ (μ¬κΈ°μλ λ¨μν λ²νΌμΌλ‘ ꡬν)
|
44 |
+
if st.button(f"Play Video {index+1}", key=f"video{index+1}"):
|
45 |
+
selected_video = video_paths[index]
|
46 |
+
|
47 |
+
# μ νλ λΉλμ€ μ¬μ
|
48 |
+
if selected_video:
|
49 |
+
st.video(selected_video)
|