seawolf2357 commited on
Commit
f1a2b12
Β·
verified Β·
1 Parent(s): e6bc869

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -22
app.py CHANGED
@@ -12,34 +12,27 @@ menus = {
12
  "Scripts": ["Script"]
13
  }
14
 
15
- # μ„ νƒλœ 메뉴 ν•­λͺ©μ„ μ €μž₯ν•  λ³€μˆ˜, κΈ°λ³Έκ°’μœΌλ‘œ None μ„€μ •
16
- selected_menu = None
17
- selected_sub_menu = None
18
-
19
- # 메뉴 선택 처리
20
  selected_menu = st.sidebar.selectbox("Menu", list(menus.keys()))
21
- if selected_menu:
22
- selected_sub_menu = st.sidebar.selectbox("Sub Menu", menus[selected_menu])
23
 
24
- # μ—¬κΈ°μ„œλΆ€ν„°λŠ” μ‚¬μš©μžκ°€ μ„ νƒν•œ 메뉴에 따라 λ‹€λ₯Έ λ‘œμ§μ„ μ‹€ν–‰ν•©λ‹ˆλ‹€.
25
  # 'Template Video'κ°€ μ„ νƒλ˜μ—ˆμ„ λ•Œ λΉ„λ””μ˜€ 가러리λ₯Ό ν‘œμ‹œ
26
  if selected_menu == "Free Stock" and selected_sub_menu == "Template Video":
27
  st.subheader("Template Videos")
28
 
29
- # λΉ„λ””μ˜€ 가러리 및 μ„ νƒλœ λΉ„λ””μ˜€ μž¬μƒ λ‘œμ§μ„ 여기에 κ΅¬ν˜„ν•©λ‹ˆλ‹€.
30
- # 예λ₯Ό λ“€μ–΄, λΉ„λ””μ˜€ 파일 λͺ©λ‘μ„ μƒμ„±ν•˜κ³ , μ‚¬μš©μžκ°€ μ„ νƒν•œ λΉ„λ””μ˜€λ₯Ό μž¬μƒν•˜λŠ” μ½”λ“œ λ“±
31
-
32
- # λΉ„λ””μ˜€ 파일과 썸넀일 이미지 경둜 μ„€μ •
33
  video_files = ["ex1.mp4", "ex2.mp4", "ex3.mp4", "ex4.mp4", "ex5.mp4", "ex6.mp4"]
34
- thumbnails = ["thum1.png", "thum2.png", "thum3.png", "thum4.png", "thum5.png", "thum6.png"]
35
 
36
- # 가러리 ν˜•νƒœλ‘œ 썸넀일 ν‘œμ‹œ
37
- cols = st.columns(3)
38
- for index, thumbnail in enumerate(thumbnails):
39
- with cols[index % 3]:
40
- st.image(thumbnail, width=200, caption=f"Video {index+1}")
41
- # 'Play Video' λ²„νŠΌ μΆ”κ°€
42
- if st.button(f"Play Video {index+1}", key=f"play_{index}"):
43
- # μ„ νƒλœ λΉ„λ””μ˜€ μž¬μƒ
44
  st.video(video_files[index])
45
-
 
 
 
 
12
  "Scripts": ["Script"]
13
  }
14
 
15
+ # μ„ νƒλœ 메뉴 ν•­λͺ©μ„ μ €μž₯ν•  λ³€μˆ˜
 
 
 
 
16
  selected_menu = st.sidebar.selectbox("Menu", list(menus.keys()))
17
+ selected_sub_menu = st.sidebar.selectbox("Sub Menu", menus[selected_menu])
 
18
 
 
19
  # 'Template Video'κ°€ μ„ νƒλ˜μ—ˆμ„ λ•Œ λΉ„λ””μ˜€ 가러리λ₯Ό ν‘œμ‹œ
20
  if selected_menu == "Free Stock" and selected_sub_menu == "Template Video":
21
  st.subheader("Template Videos")
22
 
23
+ # λΉ„λ””μ˜€ 파일 경둜 μ„€μ •
 
 
 
24
  video_files = ["ex1.mp4", "ex2.mp4", "ex3.mp4", "ex4.mp4", "ex5.mp4", "ex6.mp4"]
 
25
 
26
+ # 가러리 ν˜•νƒœλ‘œ λΉ„λ””μ˜€ ν‘œμ‹œ
27
+ cols = st.columns(3) # 3개의 μ—΄ 생성
28
+ index = 0 # λΉ„λ””μ˜€ 인덱슀 μ΄ˆκΈ°ν™”
29
+
30
+ # 각 열에 λΉ„λ””μ˜€ 배치
31
+ for col in cols:
32
+ with col:
33
+ if index < len(video_files):
34
  st.video(video_files[index])
35
+ index += 1
36
+ if index < len(video_files):
37
+ st.video(video_files[index])
38
+ index += 1