brendabor commited on
Commit
65d25f2
1 Parent(s): 0155227

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -61,6 +61,10 @@ def hybrid_recommendation(song_index, top_n=10):
61
  content_based_recs = recommend_cont(song_index, top_n)
62
  knn_based_recs = recommend_knn(song_index, top_n)
63
  combined_recs = pd.concat([content_based_recs, knn_based_recs])
 
 
 
 
64
  hybrid_recs = combined_recs.groupby(combined_recs.index).mean().sort_values(by='score', ascending=False).head(top_n)
65
  return hybrid_recs
66
 
 
61
  content_based_recs = recommend_cont(song_index, top_n)
62
  knn_based_recs = recommend_knn(song_index, top_n)
63
  combined_recs = pd.concat([content_based_recs, knn_based_recs])
64
+
65
+ # Convert 'score' column to numeric
66
+ combined_recs['score'] = pd.to_numeric(combined_recs['score'], errors='coerce')
67
+
68
  hybrid_recs = combined_recs.groupby(combined_recs.index).mean().sort_values(by='score', ascending=False).head(top_n)
69
  return hybrid_recs
70