fabiogra commited on
Commit
cc7efca
1 Parent(s): 444aecb

feat: move first Separate page, and examples

Browse files
Files changed (2) hide show
  1. app/header.py +2 -2
  2. app/pages/Separate.py +17 -17
app/header.py CHANGED
@@ -31,7 +31,7 @@ def header(logo_and_title=True):
31
  if "search_results" not in st.session_state:
32
  st.session_state.search_results = []
33
  if "page" not in st.session_state:
34
- st.session_state.page = "Karaoke"
35
  switch_page(st.session_state.page)
36
 
37
  st.set_page_config(
@@ -42,7 +42,7 @@ def header(logo_and_title=True):
42
  )
43
  st.markdown(CSS, unsafe_allow_html=True)
44
 
45
- options = ["Karaoke", "Separate", "About"]
46
  page = option_menu(
47
  menu_title=None,
48
  options=options,
 
31
  if "search_results" not in st.session_state:
32
  st.session_state.search_results = []
33
  if "page" not in st.session_state:
34
+ st.session_state.page = "Separate"
35
  switch_page(st.session_state.page)
36
 
37
  st.set_page_config(
 
42
  )
43
  st.markdown(CSS, unsafe_allow_html=True)
44
 
45
+ options = ["Separate", "Karaoke", "About"]
46
  page = option_menu(
47
  menu_title=None,
48
  options=options,
app/pages/Separate.py CHANGED
@@ -111,7 +111,7 @@ def body():
111
  with st.columns([1, 8, 1])[1]:
112
  option = option_menu(
113
  menu_title=None,
114
- options=["Upload File", "From URL", "Examples"],
115
  icons=["cloud-upload-fill", "link-45deg", "music-note-list"],
116
  orientation="horizontal",
117
  styles={
@@ -136,7 +136,22 @@ def body():
136
  },
137
  key="option_separate",
138
  )
139
- if option == "Upload File":
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  uploaded_file = st.file_uploader(
141
  "Choose a file",
142
  type=extensions,
@@ -182,21 +197,6 @@ def body():
182
  )
183
  filename = None
184
 
185
- elif option == "Examples":
186
- samples_song = load_list_of_songs(path="separate_songs.json")
187
- if samples_song is not None:
188
- name_song = st.selectbox(
189
- label="Select a song",
190
- options=list(samples_song.keys()),
191
- format_func=lambda x: x.replace("_", " "),
192
- index=1,
193
- key="select_example",
194
- )
195
- if (Path("/tmp") / name_song).exists():
196
- st_local_audio(Path("/tmp") / name_song, key=f"input_from_sample_{name_song}")
197
- else:
198
- name_song = None
199
-
200
  with cols[3]:
201
  separation_mode = st.selectbox(
202
  "Choose the separation mode",
 
111
  with st.columns([1, 8, 1])[1]:
112
  option = option_menu(
113
  menu_title=None,
114
+ options=["Examples", "Upload File", "From URL"],
115
  icons=["cloud-upload-fill", "link-45deg", "music-note-list"],
116
  orientation="horizontal",
117
  styles={
 
136
  },
137
  key="option_separate",
138
  )
139
+ if option == "Examples":
140
+ samples_song = load_list_of_songs(path="separate_songs.json")
141
+ if samples_song is not None:
142
+ name_song = st.selectbox(
143
+ label="Select a song",
144
+ options=list(samples_song.keys()),
145
+ format_func=lambda x: x.replace("_", " "),
146
+ index=1,
147
+ key="select_example",
148
+ )
149
+ if (Path("/tmp") / name_song).exists():
150
+ st_local_audio(Path("/tmp") / name_song, key=f"input_from_sample_{name_song}")
151
+ else:
152
+ name_song = None
153
+
154
+ elif option == "Upload File":
155
  uploaded_file = st.file_uploader(
156
  "Choose a file",
157
  type=extensions,
 
197
  )
198
  filename = None
199
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  with cols[3]:
201
  separation_mode = st.selectbox(
202
  "Choose the separation mode",