seawolf2357 commited on
Commit
28cb32b
Β·
verified Β·
1 Parent(s): 21386dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -33
app.py CHANGED
@@ -1,6 +1,44 @@
1
  import streamlit as st
2
  import requests
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  # Pexels API ν‚€ μ„€μ •
5
  PEXELS_API_KEY = "5woz23MGx1QrSY0WHFb0BRi29JvbXPu97Hg0xnklYgHUI8G0w23FKH62"
6
 
@@ -47,39 +85,6 @@ if selected_menu == "Free Stock" and st.session_state['current_sub_menu'] == "Se
47
 
48
 
49
 
50
- # νŽ˜μ΄μ§€ μ„€μ •
51
- st.set_page_config(page_title="ViDraft", layout="wide")
52
-
53
- # μ‚¬μ΄λ“œλ°” 타이틀 μ„€μ •
54
- st.sidebar.title("ViDraft")
55
-
56
- # 메뉴 및 ν•˜μœ„ 메뉴 μ •μ˜
57
- menus = {
58
- "Home": [],
59
- "Free Stock": ["Template Video", "Template Image", "Search Video", "Search Image"],
60
- "Image": ["Generation", "Face ID", "Inpainting", "Remove Background", "Studio"],
61
- "Video": ["Generation", "Talking Face", "Remove Background", "Studio"],
62
- "Sound": ["Video SFX", "Video Music", "TTS(Voice)", "Image SFX", "Image Music"],
63
- "Scripts": []
64
- }
65
-
66
- # μ„Έμ…˜ μƒνƒœ μ΄ˆκΈ°ν™”
67
- if 'current_menu' not in st.session_state:
68
- st.session_state['current_menu'] = 'Home'
69
- if 'current_sub_menu' not in st.session_state:
70
- st.session_state['current_sub_menu'] = ''
71
-
72
- # 메인 메뉴 선택
73
- selected_menu = st.sidebar.selectbox("Menu", list(menus.keys()))
74
- st.session_state['current_menu'] = selected_menu
75
-
76
- # ν•˜μœ„ 메뉴 선택 (ν•΄λ‹Ήλ˜λŠ” 경우)
77
- if selected_menu in menus:
78
- selected_sub_menu = st.sidebar.selectbox("Sub Menu", [""] + menus[selected_menu])
79
- st.session_state['current_sub_menu'] = selected_sub_menu
80
- else:
81
- st.session_state['current_sub_menu'] = ''
82
-
83
  # 'Home' νŽ˜μ΄μ§€ ν‘œμ‹œ
84
  if selected_menu == "Home":
85
  st.header("Welcome to ViDraft")
 
1
  import streamlit as st
2
  import requests
3
 
4
+
5
+ # νŽ˜μ΄μ§€ μ„€μ •
6
+ st.set_page_config(page_title="ViDraft", layout="wide")
7
+
8
+ # μ‚¬μ΄λ“œλ°” 타이틀 μ„€μ •
9
+ st.sidebar.title("ViDraft")
10
+
11
+ # 메뉴 및 ν•˜μœ„ 메뉴 μ •μ˜
12
+ menus = {
13
+ "Home": [],
14
+ "Free Stock": ["Template Video", "Template Image", "Search Video", "Search Image"],
15
+ "Image": ["Generation", "Face ID", "Inpainting", "Remove Background", "Studio"],
16
+ "Video": ["Generation", "Talking Face", "Remove Background", "Studio"],
17
+ "Sound": ["Video SFX", "Video Music", "TTS(Voice)", "Image SFX", "Image Music"],
18
+ "Scripts": []
19
+ }
20
+
21
+ # μ„Έμ…˜ μƒνƒœ μ΄ˆκΈ°ν™”
22
+ if 'current_menu' not in st.session_state:
23
+ st.session_state['current_menu'] = 'Home'
24
+ if 'current_sub_menu' not in st.session_state:
25
+ st.session_state['current_sub_menu'] = ''
26
+
27
+ # 메인 메뉴 선택
28
+ selected_menu = st.sidebar.selectbox("Menu", list(menus.keys()))
29
+ st.session_state['current_menu'] = selected_menu
30
+
31
+ # μ—¬κΈ°μ—μ„œ `selected_menu` λ³€μˆ˜κ°€ 이미 μ •μ˜λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이제 ν•˜μœ„ 메뉴 선택 이후 μ‚¬μš©μ΄ μ‹œμž‘λ©λ‹ˆλ‹€.
32
+
33
+ # ν•˜μœ„ 메뉴 선택 (ν•΄λ‹Ήλ˜λŠ” 경우)
34
+ if selected_menu in menus:
35
+ selected_sub_menu = st.sidebar.selectbox("Sub Menu", [""] + menus[selected_menu])
36
+ st.session_state['current_sub_menu'] = selected_sub_menu
37
+ else:
38
+ st.session_state['current_sub_menu'] = ''
39
+
40
+ # μ—¬κΈ°μ„œλΆ€ν„° `selected_menu` λ³€μˆ˜λ₯Ό 기반으둜 쑰건문을 μ‚¬μš©ν•˜λŠ” λ‚˜λ¨Έμ§€ μ½”λ“œκ°€ μ˜¬λ°”λ₯΄κ²Œ μž‘λ™ν•  κ²ƒμž…λ‹ˆλ‹€.
41
+
42
  # Pexels API ν‚€ μ„€μ •
43
  PEXELS_API_KEY = "5woz23MGx1QrSY0WHFb0BRi29JvbXPu97Hg0xnklYgHUI8G0w23FKH62"
44
 
 
85
 
86
 
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  # 'Home' νŽ˜μ΄μ§€ ν‘œμ‹œ
89
  if selected_menu == "Home":
90
  st.header("Welcome to ViDraft")