ccolas commited on
Commit
dde73a1
1 Parent(s): dbea0da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -14
app.py CHANGED
@@ -11,10 +11,10 @@ debug = False
11
  dir_path = os.path.dirname(os.path.realpath(__file__))
12
 
13
  st.set_page_config(
14
- page_title="EmotionPlaylist",
15
  page_icon="🎧",
16
  )
17
- st.title('Customize Emotional Playlists')
18
 
19
 
20
  def log_to_spotify():
@@ -147,9 +147,7 @@ def select_songs(legit_genres):
147
  st.markdown("This can be done in two ways: \n"
148
  "1. Get songs from a list of users (and their playlists)\n"
149
  "2. Get songs from a list of playlists.\n"
150
- "For this you'll need to collect user urls (e.g. https://open.spotify.com/user/bkayf) and/or playlist urls (e.g. "
151
- "https://open.spotify.com/playlist/1H7a4q8JZArMQiidRy6qon) by clicking on 'Share' and copying the url. "
152
- "You need to provide at least one source of music.")
153
 
154
  users_playlists = "Add a list of user urls, one per line (optional)"
155
  users_links = st.text_area(users_playlists, value="")
@@ -205,7 +203,7 @@ def customize_widgets(genres_labels, updated_sources):
205
  expanded = True if 'expanded_genres' in st.session_state else False
206
  with st.expander("Unroll to select (default all)", expanded=expanded):
207
  st.session_state['expanded_genres'] = True
208
- st.markdown("Check boxes to select genres, see how many tracks were selected below. Note: to check all, first uncheck all (bug).")
209
  columns = st.columns(np.ones(5))
210
  with columns[1]:
211
  check_all = st.button('Check all')
@@ -337,16 +335,10 @@ def run_app():
337
  st.image(image)
338
  st.markdown("This app let's you quickly build playlists in a customized way: ")
339
  st.markdown("* **It's easy**: you won't have to add songs one by one,\n"
340
- "* **You're in control**: you provide a source of candidate songs, select a list of genres and choose the mood for the playlist.")
341
- fake = centered_button(st.button, "Let's go", n_columns=7, disabled=True)
342
-
343
  sp, user_id, legit_genres, auth_manager = log_to_spotify()
344
 
345
- def reauthenticate():
346
- global sp
347
- auth_manager.get_access_token(st.experimental_get_query_params()['code'])
348
- sp = spotipy.Spotify(auth_manager=auth_manager)
349
- return sp
350
 
351
  if 'login' in st.session_state or debug:
352
  all_tracks_uris, all_tracks_audio_features, all_tracks_genres, indexes_by_genre, genres_labels, updated_sources = select_songs(legit_genres)
 
11
  dir_path = os.path.dirname(os.path.realpath(__file__))
12
 
13
  st.set_page_config(
14
+ page_title="EmotionalPlaylist",
15
  page_icon="🎧",
16
  )
17
+ st.title('Emotional Playlists')
18
 
19
 
20
  def log_to_spotify():
 
147
  st.markdown("This can be done in two ways: \n"
148
  "1. Get songs from a list of users (and their playlists)\n"
149
  "2. Get songs from a list of playlists.\n"
150
+ "For this you'll need to collect user and/or playlist urls by clicking on \"Share\" and \"Copy link\" in the Spotify app.")
 
 
151
 
152
  users_playlists = "Add a list of user urls, one per line (optional)"
153
  users_links = st.text_area(users_playlists, value="")
 
203
  expanded = True if 'expanded_genres' in st.session_state else False
204
  with st.expander("Unroll to select (default all)", expanded=expanded):
205
  st.session_state['expanded_genres'] = True
206
+ st.markdown("Check boxes to select genres. Note: to check all, first uncheck all (bug).")
207
  columns = st.columns(np.ones(5))
208
  with columns[1]:
209
  check_all = st.button('Check all')
 
335
  st.image(image)
336
  st.markdown("This app let's you quickly build playlists in a customized way: ")
337
  st.markdown("* **It's easy**: you won't have to add songs one by one,\n"
338
+ "* **You're in control**: you provide the source of songs, select genres and pick the mood,\n"
339
+ "* **You're free to explore**: set the exploration strength from no new songs to all new songs.")
 
340
  sp, user_id, legit_genres, auth_manager = log_to_spotify()
341
 
 
 
 
 
 
342
 
343
  if 'login' in st.session_state or debug:
344
  all_tracks_uris, all_tracks_audio_features, all_tracks_genres, indexes_by_genre, genres_labels, updated_sources = select_songs(legit_genres)