Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,8 @@ from transformers import RobertaTokenizer, TFRobertaForSequenceClassification
|
|
6 |
from sentence_transformers import SentenceTransformer, util
|
7 |
import spotipy
|
8 |
from spotipy.oauth2 import SpotifyClientCredentials
|
|
|
|
|
9 |
|
10 |
sim_model = SentenceTransformer("sentence-transformers/all-mpnet-base-v2")
|
11 |
|
@@ -46,8 +48,8 @@ def match_songs_with_sentiment(user_sentiment_label, user_sentiment_score,inputV
|
|
46 |
# Select the top five songs and return
|
47 |
return matched_songs.loc[top_5.index, ['song','artist','seq','similarity','sentiment','score']]
|
48 |
|
49 |
-
client_id = '
|
50 |
-
client_secret = '
|
51 |
|
52 |
client_credentials_manager = SpotifyClientCredentials(client_id=client_id, client_secret=client_secret)
|
53 |
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
|
|
6 |
from sentence_transformers import SentenceTransformer, util
|
7 |
import spotipy
|
8 |
from spotipy.oauth2 import SpotifyClientCredentials
|
9 |
+
import os
|
10 |
+
from dotenv import load_dotenv
|
11 |
|
12 |
sim_model = SentenceTransformer("sentence-transformers/all-mpnet-base-v2")
|
13 |
|
|
|
48 |
# Select the top five songs and return
|
49 |
return matched_songs.loc[top_5.index, ['song','artist','seq','similarity','sentiment','score']]
|
50 |
|
51 |
+
client_id = os.getenv('client_id')
|
52 |
+
client_secret = os.getenv('client_secret')
|
53 |
|
54 |
client_credentials_manager = SpotifyClientCredentials(client_id=client_id, client_secret=client_secret)
|
55 |
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|