Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -63,8 +63,13 @@ sequence = tokenizer.texts_to_sequences([query_data['lyrics']])
|
|
63 |
padded_sequence = pad_sequences(sequence, maxlen=50)
|
64 |
emotion = emotion_model.predict(padded_sequence).flatten()
|
65 |
|
|
|
|
|
|
|
|
|
|
|
66 |
# Combine emotion and audio features for recommendation
|
67 |
-
combined_features_hybrid = np.concatenate([
|
68 |
|
69 |
# Generate recommendations using the hybrid model
|
70 |
hybrid_recs = hybrid_recommendation(song_index=0)
|
|
|
63 |
padded_sequence = pad_sequences(sequence, maxlen=50)
|
64 |
emotion = emotion_model.predict(padded_sequence).flatten()
|
65 |
|
66 |
+
# Mapping emotion predictions to encoded categories
|
67 |
+
emotion_mapping = {0: 'happy', 1: 'sad', 2: 'calm', 3: 'anger'}
|
68 |
+
encoded_emotion = np.argmax(emotion)
|
69 |
+
emotion_category = emotion_mapping[encoded_emotion]
|
70 |
+
|
71 |
# Combine emotion and audio features for recommendation
|
72 |
+
combined_features_hybrid = np.concatenate([encoded_emotion, query_data[audio_feature_columns].values])
|
73 |
|
74 |
# Generate recommendations using the hybrid model
|
75 |
hybrid_recs = hybrid_recommendation(song_index=0)
|