Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -43,8 +43,15 @@ st.title('KNN Recommender App')
|
|
43 |
song_index_to_recommend = st.number_input('Enter song index:', min_value=0, max_value=len(df)-1, value=0)
|
44 |
|
45 |
# Combine emotion and audio features for recommendation
|
46 |
-
#combined_features = np.concatenate([emotion, audio_features_scaled_knn[song_index_to_recommend]])
|
47 |
|
|
|
|
|
|
|
|
|
48 |
st.write("KNN Recommendations:")
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
43 |
song_index_to_recommend = st.number_input('Enter song index:', min_value=0, max_value=len(df)-1, value=0)
|
44 |
|
45 |
# Combine emotion and audio features for recommendation
|
46 |
+
# combined_features = np.concatenate([emotion, audio_features_scaled_knn[song_index_to_recommend]])
|
47 |
|
48 |
+
# Get KNN recommendations
|
49 |
+
knn_recs = recommend_knn(song_index_to_recommend)
|
50 |
+
|
51 |
+
# Display KNN recommendations
|
52 |
st.write("KNN Recommendations:")
|
53 |
+
if not knn_recs.empty:
|
54 |
+
for index in knn_recs.index:
|
55 |
+
st.write(f"Song Index: {index}, Title: {df.iloc[index]['title']}, Artist: {df.iloc[index]['artist']}, Score: {knn_recs.loc[index, 'score']}")
|
56 |
+
else:
|
57 |
+
st.write("No recommendations found.")
|