Spaces:
Runtime error
Runtime error
Commit
·
8dfab5d
1
Parent(s):
c1e1e87
modified: model.py
Browse files
model.py
CHANGED
|
@@ -289,9 +289,22 @@ def playlist_model(url, model, max_gen=3, same_art=5):
|
|
| 289 |
|
| 290 |
def top_tracks(url,region):
|
| 291 |
uri = url.split('/')[-1].split('?')[0]
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 295 |
sp = spotipy.client.Spotify(auth_manager=auth_manager)
|
| 296 |
log = []
|
| 297 |
Fresult = []
|
|
@@ -312,11 +325,23 @@ def song_model(url, model, max_gen=3, same_art=5):
|
|
| 312 |
try:
|
| 313 |
log.append('Start logging')
|
| 314 |
uri = url.split('/')[-1].split('?')[0]
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
|
| 321 |
if model == 'Spotify Model':
|
| 322 |
log.append('Starting Spotify Model')
|
|
|
|
| 289 |
|
| 290 |
def top_tracks(url,region):
|
| 291 |
uri = url.split('/')[-1].split('?')[0]
|
| 292 |
+
try:
|
| 293 |
+
log.append('spotify local method')
|
| 294 |
+
stream = open("Spotify/Spotify.yaml")
|
| 295 |
+
spotify_details = yaml.safe_load(stream)
|
| 296 |
+
auth_manager = SpotifyClientCredentials(client_id=spotify_details['Client_id'], client_secret=spotify_details['client_secret'])
|
| 297 |
+
except:
|
| 298 |
+
log.append('spotify .streamlit method')
|
| 299 |
+
try:
|
| 300 |
+
Client_id=st.secrets["Client_ID"]
|
| 301 |
+
client_secret=st.secrets["Client_secret"]
|
| 302 |
+
auth_manager = SpotifyClientCredentials(client_id=Client_id, client_secret=client_secret)
|
| 303 |
+
except:
|
| 304 |
+
log.append('spotify hug method')
|
| 305 |
+
Client_id=os.environ['Client_ID']
|
| 306 |
+
client_secret=os.environ['Client_secret']
|
| 307 |
+
auth_manager = SpotifyClientCredentials(client_id=Client_id, client_secret=client_secret)
|
| 308 |
sp = spotipy.client.Spotify(auth_manager=auth_manager)
|
| 309 |
log = []
|
| 310 |
Fresult = []
|
|
|
|
| 325 |
try:
|
| 326 |
log.append('Start logging')
|
| 327 |
uri = url.split('/')[-1].split('?')[0]
|
| 328 |
+
try:
|
| 329 |
+
log.append('spotify local method')
|
| 330 |
+
stream = open("Spotify/Spotify.yaml")
|
| 331 |
+
spotify_details = yaml.safe_load(stream)
|
| 332 |
+
auth_manager = SpotifyClientCredentials(client_id=spotify_details['Client_id'], client_secret=spotify_details['client_secret'])
|
| 333 |
+
except:
|
| 334 |
+
log.append('spotify .streamlit method')
|
| 335 |
+
try:
|
| 336 |
+
Client_id=st.secrets["Client_ID"]
|
| 337 |
+
client_secret=st.secrets["Client_secret"]
|
| 338 |
+
auth_manager = SpotifyClientCredentials(client_id=Client_id, client_secret=client_secret)
|
| 339 |
+
except:
|
| 340 |
+
log.append('spotify hug method')
|
| 341 |
+
Client_id=os.environ['Client_ID']
|
| 342 |
+
client_secret=os.environ['Client_secret']
|
| 343 |
+
auth_manager = SpotifyClientCredentials(client_id=Client_id, client_secret=client_secret)
|
| 344 |
+
sp = spotipy.client.Spotify(auth_manager=auth_manager)
|
| 345 |
|
| 346 |
if model == 'Spotify Model':
|
| 347 |
log.append('Starting Spotify Model')
|