Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -24,8 +24,7 @@ import spotipy
|
|
24 |
from spotipy.oauth2 import SpotifyClientCredentials
|
25 |
|
26 |
client_id = "85e49fdb7eb54d84a8da5609196538e7"
|
27 |
-
|
28 |
-
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
29 |
|
30 |
|
31 |
|
@@ -42,6 +41,8 @@ df_num = df.select_dtypes(include = ['float64', 'int64'])
|
|
42 |
|
43 |
numeric_cols = ['acousticness', 'danceability', 'energy', 'instrumentalness', 'liveness', 'loudness', 'speechiness', 'tempo', 'valence']
|
44 |
categorical_cols = ['key', 'mode']
|
|
|
|
|
45 |
|
46 |
# Create the preprocessing pipeline
|
47 |
preprocessing_pipeline = ColumnTransformer(
|
@@ -52,11 +53,12 @@ preprocessing_pipeline = ColumnTransformer(
|
|
52 |
|
53 |
# Apply the preprocessing pipeline to your DataFrame
|
54 |
df_processed = preprocessing_pipeline.fit_transform(df_num)
|
55 |
-
|
56 |
num_cols_transformed = numeric_cols
|
57 |
cat_cols_transformed = preprocessing_pipeline.named_transformers_['cat'].get_feature_names_out(categorical_cols)
|
58 |
|
59 |
# Combine the transformed column names
|
|
|
60 |
all_cols_transformed = num_cols_transformed + cat_cols_transformed.tolist()
|
61 |
|
62 |
# Convert the processed NumPy array back to a DataFrame
|
|
|
24 |
from spotipy.oauth2 import SpotifyClientCredentials
|
25 |
|
26 |
client_id = "85e49fdb7eb54d84a8da5609196538e7"
|
27 |
+
|
|
|
28 |
|
29 |
|
30 |
|
|
|
41 |
|
42 |
numeric_cols = ['acousticness', 'danceability', 'energy', 'instrumentalness', 'liveness', 'loudness', 'speechiness', 'tempo', 'valence']
|
43 |
categorical_cols = ['key', 'mode']
|
44 |
+
client_secret="16d293ae0c5a4c6ea3e8e301c75bcd43"
|
45 |
+
|
46 |
|
47 |
# Create the preprocessing pipeline
|
48 |
preprocessing_pipeline = ColumnTransformer(
|
|
|
53 |
|
54 |
# Apply the preprocessing pipeline to your DataFrame
|
55 |
df_processed = preprocessing_pipeline.fit_transform(df_num)
|
56 |
+
client_credentials_manager = SpotifyClientCredentials(client_id=client_id)
|
57 |
num_cols_transformed = numeric_cols
|
58 |
cat_cols_transformed = preprocessing_pipeline.named_transformers_['cat'].get_feature_names_out(categorical_cols)
|
59 |
|
60 |
# Combine the transformed column names
|
61 |
+
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
62 |
all_cols_transformed = num_cols_transformed + cat_cols_transformed.tolist()
|
63 |
|
64 |
# Convert the processed NumPy array back to a DataFrame
|