fabiogra commited on
Commit
5472963
1 Parent(s): 1245f2e

feat: improve UI and text

Browse files
Files changed (3) hide show
  1. app/pages/Karaoke.py +5 -2
  2. app/pages/Separate.py +10 -17
  3. app/style.py +19 -1
app/pages/Karaoke.py CHANGED
@@ -89,13 +89,16 @@ def show_karaoke(pathname):
89
 
90
 
91
  def body():
92
- st.markdown("<center>Search for a song on YouTube<center>", unsafe_allow_html=True)
 
 
 
93
  yt_cols = st.columns([1, 3, 2, 1])
94
  with yt_cols[1]:
95
  selected_value = st_searchbox(
96
  search_youtube,
97
  label=None,
98
- placeholder="Search by name...",
99
  clear_on_submit=True,
100
  key="yt_searchbox",
101
  )
 
89
 
90
 
91
  def body():
92
+ st.markdown(
93
+ "<h4><center>Play karaoke removing the vocals of your favorite song <center></h4>",
94
+ unsafe_allow_html=True,
95
+ )
96
  yt_cols = st.columns([1, 3, 2, 1])
97
  with yt_cols[1]:
98
  selected_value = st_searchbox(
99
  search_youtube,
100
  label=None,
101
+ placeholder="Search on YouTube by name...",
102
  clear_on_submit=True,
103
  key="yt_searchbox",
104
  )
app/pages/Separate.py CHANGED
@@ -5,6 +5,7 @@ from loguru import logger as log
5
 
6
  import requests
7
  import streamlit as st
 
8
 
9
  from footer import footer
10
  from header import header
@@ -19,7 +20,7 @@ from helpers import (
19
  )
20
  from service.demucs_runner import separator
21
  from service.vocal_remover.runner import load_model, separate
22
- from streamlit_option_menu import option_menu
23
 
24
 
25
  label_sources = {
@@ -92,21 +93,13 @@ def body():
92
  filename = None
93
  name_song = None
94
  st.markdown(
95
- """<style>
96
- div[data-baseweb="tab-list"] {
97
- display: flex !important;
98
- align-items: center !important;
99
- justify-content: space-evenly !important;
100
- flex-wrap: wrap !important;
101
- .css-q8sbsg.e16nr0p34 p{
102
- font-size: 1.1rem !important;
103
- }
104
- }
105
- </style>""",
106
  unsafe_allow_html=True,
107
  )
 
 
 
108
 
109
- cols = st.columns([1, 6, 1, 4, 1])
110
  with cols[1]:
111
  with st.columns([1, 8, 1])[1]:
112
  option = option_menu(
@@ -140,13 +133,13 @@ def body():
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
 
5
 
6
  import requests
7
  import streamlit as st
8
+ from streamlit_option_menu import option_menu
9
 
10
  from footer import footer
11
  from header import header
 
20
  )
21
  from service.demucs_runner import separator
22
  from service.vocal_remover.runner import load_model, separate
23
+ from style import CSS_TABS
24
 
25
 
26
  label_sources = {
 
93
  filename = None
94
  name_song = None
95
  st.markdown(
96
+ "<h4><center>Extract Vocals & Instrumental from any song</center></h4>",
 
 
 
 
 
 
 
 
 
 
97
  unsafe_allow_html=True,
98
  )
99
+ st.markdown(CSS_TABS, unsafe_allow_html=True)
100
+
101
+ cols = st.columns([1, 4, 1, 3, 1])
102
 
 
103
  with cols[1]:
104
  with st.columns([1, 8, 1])[1]:
105
  option = option_menu(
 
133
  samples_song = load_list_of_songs(path="separate_songs.json")
134
  if samples_song is not None:
135
  name_song = st.selectbox(
136
+ label="Select a sample song and listen to sources separated",
137
+ options=list(samples_song.keys()) + [""],
138
  format_func=lambda x: x.replace("_", " "),
139
+ index=len(samples_song),
140
  key="select_example",
141
  )
142
+ if name_song != "" and (Path("/tmp") / name_song).exists():
143
  st_local_audio(Path("/tmp") / name_song, key=f"input_from_sample_{name_song}")
144
  else:
145
  name_song = None
app/style.py CHANGED
@@ -104,6 +104,12 @@ CSS = (
104
  text-align: center;
105
  }
106
 
 
 
 
 
 
 
107
  /* Desktop */
108
  @media (min-width: 640px) {
109
  .css-zt5igj, .css-nahz7x p {
@@ -130,8 +136,20 @@ CSS = (
130
  justify-content: center;
131
  align-items: center;
132
  }
133
-
134
  </style>
135
 
136
  """
137
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  text-align: center;
105
  }
106
 
107
+ #extract-vocals-instrumental-from-any-song, #play-karaoke-removing-the-vocals-of-your-favorite-song {
108
+ font-family: """
109
+ + _font_subtitle
110
+ + """, sans-serif;
111
+ }
112
+
113
  /* Desktop */
114
  @media (min-width: 640px) {
115
  .css-zt5igj, .css-nahz7x p {
 
136
  justify-content: center;
137
  align-items: center;
138
  }
 
139
  </style>
140
 
141
  """
142
  )
143
+
144
+
145
+ CSS_TABS = """<style>
146
+ div[data-baseweb="tab-list"] {
147
+ display: flex !important;
148
+ align-items: center !important;
149
+ justify-content: space-evenly !important;
150
+ flex-wrap: wrap !important;
151
+ .css-q8sbsg.e16nr0p34 p{
152
+ font-size: 1.1rem !important;
153
+ }
154
+ }
155
+ </style>"""