carterwward commited on
Commit ·
b42d8ba
1
Parent(s): 7e20444
test api connection
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ from src.playlist_builder import SEED_OPTIONS, CROSSOVER_OPTIONS, MUTATION_OPTIO
|
|
| 3 |
set_crossover_option, set_mutation_option, update_mutation_size, change_seed_option, search_for_seed, set_pop_seed ,set_track_state, get_next_generation, add_playlist_to_spotify, \
|
| 4 |
generate_population_direction_tracking_viz
|
| 5 |
from src.evolutionary_alrogithm import Population, simple_mutation, simple_crossover, THUMBS_UP, THUMBS_DOWN, ADD_TO_PLAYLIST
|
| 6 |
-
from src.spotipy_utils import get_auth_manager, get_sp_client
|
| 7 |
|
| 8 |
NUM_SONGS = 9
|
| 9 |
DEFAULT_MUTATION_SIZE = 0.25
|
|
@@ -14,6 +14,14 @@ APP_HEADER = """# Evolutionary Playlist Builder"""
|
|
| 14 |
EXPLORATION_HEADER = """## Rate of Exploration"""
|
| 15 |
PLAYLIST_HEADER = """## Current Playlist"""
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
def initialize_playlist_builder():
|
| 18 |
demo = gr.Blocks()
|
| 19 |
with demo:
|
|
@@ -168,12 +176,12 @@ def initialize_playlist_builder():
|
|
| 168 |
return demo
|
| 169 |
|
| 170 |
|
| 171 |
-
def main():
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
|
| 177 |
|
| 178 |
-
if __name__ == '__main__':
|
| 179 |
-
|
|
|
|
| 3 |
set_crossover_option, set_mutation_option, update_mutation_size, change_seed_option, search_for_seed, set_pop_seed ,set_track_state, get_next_generation, add_playlist_to_spotify, \
|
| 4 |
generate_population_direction_tracking_viz
|
| 5 |
from src.evolutionary_alrogithm import Population, simple_mutation, simple_crossover, THUMBS_UP, THUMBS_DOWN, ADD_TO_PLAYLIST
|
| 6 |
+
from src.spotipy_utils import get_auth_manager, get_sp_client, CLIENT_ID, CLIENT_SECRET
|
| 7 |
|
| 8 |
NUM_SONGS = 9
|
| 9 |
DEFAULT_MUTATION_SIZE = 0.25
|
|
|
|
| 14 |
EXPLORATION_HEADER = """## Rate of Exploration"""
|
| 15 |
PLAYLIST_HEADER = """## Current Playlist"""
|
| 16 |
|
| 17 |
+
import spotipy
|
| 18 |
+
import os
|
| 19 |
+
from spotipy.oauth2 import SpotifyClientCredentials
|
| 20 |
+
auth_manager = SpotifyClientCredentials(client_id=CLIENT_ID,client_secret=CLIENT_SECRET)
|
| 21 |
+
sp_client = spotipy.client.Spotify(auth_manager=auth_manager)
|
| 22 |
+
res = sp_client.track("2RM4jf1Xa9zPgMGRDiht8O")
|
| 23 |
+
print(res)
|
| 24 |
+
|
| 25 |
def initialize_playlist_builder():
|
| 26 |
demo = gr.Blocks()
|
| 27 |
with demo:
|
|
|
|
| 176 |
return demo
|
| 177 |
|
| 178 |
|
| 179 |
+
# def main():
|
| 180 |
+
# """ Run an instance of the PlaylistBuilder class developed using Gradio and Spotipy.
|
| 181 |
+
# """
|
| 182 |
+
# playlist_app = initialize_playlist_builder()
|
| 183 |
+
# playlist_app.launch()
|
| 184 |
|
| 185 |
|
| 186 |
+
# if __name__ == '__main__':
|
| 187 |
+
# main()
|