Commit
·
c1e1e87
1
Parent(s):
5a25cd9
modified: model.py
Browse files- .gitignore +1 -1
- Data/new_tracks.csv +1 -1
- model.py +12 -3
.gitignore
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
.cache
|
2 |
__pycache__
|
3 |
Spotify/*
|
4 |
-
|
|
|
1 |
.cache
|
2 |
__pycache__
|
3 |
Spotify/*
|
4 |
+
.streamlit/
|
Data/new_tracks.csv
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 24187
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f17cb1b33e44eba031f0b3646b6a67c7acd216db988671ab2812d77a975e39b3
|
3 |
size 24187
|
model.py
CHANGED
@@ -8,6 +8,7 @@ from sklearn.metrics.pairwise import cosine_similarity
|
|
8 |
from sklearn.preprocessing import MinMaxScaler
|
9 |
import pickle
|
10 |
import streamlit as st
|
|
|
11 |
|
12 |
def playlist_model(url, model, max_gen=3, same_art=5):
|
13 |
log = []
|
@@ -16,13 +17,21 @@ def playlist_model(url, model, max_gen=3, same_art=5):
|
|
16 |
log.append('Start logging')
|
17 |
uri = url.split('/')[-1].split('?')[0]
|
18 |
try:
|
|
|
19 |
stream = open("Spotify/Spotify.yaml")
|
20 |
spotify_details = yaml.safe_load(stream)
|
21 |
auth_manager = SpotifyClientCredentials(client_id=spotify_details['Client_id'], client_secret=spotify_details['client_secret'])
|
22 |
except:
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
sp = spotipy.client.Spotify(auth_manager=auth_manager)
|
27 |
|
28 |
if model == 'Spotify Model':
|
|
|
8 |
from sklearn.preprocessing import MinMaxScaler
|
9 |
import pickle
|
10 |
import streamlit as st
|
11 |
+
import os
|
12 |
|
13 |
def playlist_model(url, model, max_gen=3, same_art=5):
|
14 |
log = []
|
|
|
17 |
log.append('Start logging')
|
18 |
uri = url.split('/')[-1].split('?')[0]
|
19 |
try:
|
20 |
+
log.append('spotify local method')
|
21 |
stream = open("Spotify/Spotify.yaml")
|
22 |
spotify_details = yaml.safe_load(stream)
|
23 |
auth_manager = SpotifyClientCredentials(client_id=spotify_details['Client_id'], client_secret=spotify_details['client_secret'])
|
24 |
except:
|
25 |
+
log.append('spotify .streamlit method')
|
26 |
+
try:
|
27 |
+
Client_id=st.secrets["Client_ID"]
|
28 |
+
client_secret=st.secrets["Client_secret"]
|
29 |
+
auth_manager = SpotifyClientCredentials(client_id=Client_id, client_secret=client_secret)
|
30 |
+
except:
|
31 |
+
log.append('spotify hug method')
|
32 |
+
Client_id=os.environ['Client_ID']
|
33 |
+
client_secret=os.environ['Client_secret']
|
34 |
+
auth_manager = SpotifyClientCredentials(client_id=Client_id, client_secret=client_secret)
|
35 |
sp = spotipy.client.Spotify(auth_manager=auth_manager)
|
36 |
|
37 |
if model == 'Spotify Model':
|