Tristan Thrush commited on
Commit
83c9d16
1 Parent(s): c380117

changed scope

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -38,7 +38,7 @@ def get_features2(spotify):
38
 
39
  df = pd.DataFrame(data=features)
40
  names = [
41
- 'danceability',
42
  'energy',
43
  # 'loudness',
44
  'speechiness',
@@ -168,7 +168,7 @@ PORT_NUMBER = 8080
168
  SPOTIPY_CLIENT_ID = 'c087fa97cebb4f67b6f08ba841ed8378'
169
  SPOTIPY_CLIENT_SECRET = 'ae27d6916d114ac4bb948bb6c58a72d9'
170
  SPOTIPY_REDIRECT_URI = 'https://hf-hackathon-2023-01-spotify.hf.space'
171
- SCOPE = 'user-library-read user-read-recently-played'
172
 
173
  sp_oauth = oauth2.SpotifyOAuth(SPOTIPY_CLIENT_ID, SPOTIPY_CLIENT_SECRET, SPOTIPY_REDIRECT_URI, scope=SCOPE)
174
 
@@ -199,7 +199,7 @@ iris = data.iris()
199
 
200
 
201
  def scatter_plot_fn_energy(request: gr.Request):
202
-
203
  token = request.request.session.get('token')
204
  if token:
205
  sp = spotipy.Spotify(token)
@@ -243,7 +243,7 @@ def get_features(spotify):
243
 
244
  df = pd.DataFrame(data=features)
245
  names = [
246
- 'danceability',
247
  'energy',
248
  'loudness',
249
  'speechiness',
@@ -253,7 +253,7 @@ def get_features(spotify):
253
  'valence',
254
  'tempo',
255
  ]
256
-
257
  # print (features_means.to_json())
258
  return df
259
 
@@ -291,7 +291,7 @@ with gr.Blocks() as demo:
291
  label="Reccomended Songs",
292
  value=[["something", "something", "something"], ["something", "something", "something"]] # TODO: replace with actual reccomendations once get_started() is implemeted.
293
  )
294
-
295
  demo.load(fn=heatmap_plot_fn, outputs = heatmap_plot)
296
  demo.load(fn=scatter_plot_fn_energy, outputs = energy_plot)
297
  demo.load(fn=scatter_plot_fn_liveness, outputs = liveness_plot)
 
38
 
39
  df = pd.DataFrame(data=features)
40
  names = [
41
+ 'danceability',
42
  'energy',
43
  # 'loudness',
44
  'speechiness',
 
168
  SPOTIPY_CLIENT_ID = 'c087fa97cebb4f67b6f08ba841ed8378'
169
  SPOTIPY_CLIENT_SECRET = 'ae27d6916d114ac4bb948bb6c58a72d9'
170
  SPOTIPY_REDIRECT_URI = 'https://hf-hackathon-2023-01-spotify.hf.space'
171
+ SCOPE = 'ugc-image-upload user-read-playback-state user-modify-playback-state user-read-currently-playing app-remote-control streaming playlist-read-private playlist-read-collaborative playlist-modify-private playlist-modify-public user-follow-modify user-follow-read user-read-playback-position user-top-read user-read-recently-played user-library-modify user-library-read user-read-email user-read-private'
172
 
173
  sp_oauth = oauth2.SpotifyOAuth(SPOTIPY_CLIENT_ID, SPOTIPY_CLIENT_SECRET, SPOTIPY_REDIRECT_URI, scope=SCOPE)
174
 
 
199
 
200
 
201
  def scatter_plot_fn_energy(request: gr.Request):
202
+
203
  token = request.request.session.get('token')
204
  if token:
205
  sp = spotipy.Spotify(token)
 
243
 
244
  df = pd.DataFrame(data=features)
245
  names = [
246
+ 'danceability',
247
  'energy',
248
  'loudness',
249
  'speechiness',
 
253
  'valence',
254
  'tempo',
255
  ]
256
+
257
  # print (features_means.to_json())
258
  return df
259
 
 
291
  label="Reccomended Songs",
292
  value=[["something", "something", "something"], ["something", "something", "something"]] # TODO: replace with actual reccomendations once get_started() is implemeted.
293
  )
294
+
295
  demo.load(fn=heatmap_plot_fn, outputs = heatmap_plot)
296
  demo.load(fn=scatter_plot_fn_energy, outputs = energy_plot)
297
  demo.load(fn=scatter_plot_fn_liveness, outputs = liveness_plot)