File size: 2,042 Bytes
b036e59 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"I music2emo 02-10 03:58:55.459 music2emo.py:280] audio file loaded and feature computation success : inference/input/test.mp3\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"π΅ **Music Emotion Recognition Results** π΅\n",
"--------------------------------------------------\n",
"π **Predicted Mood Tags:** ballad, calm, film, hopeful, inspiring, love, meditative, melancholic, relaxing, romantic, sad, soft\n",
"π **Valence:** 5.42 (Scale: 1-9)\n",
"β‘ **Arousal:** 4.16 (Scale: 1-9)\n",
"--------------------------------------------------\n"
]
}
],
"source": [
"from music2emo import Music2emo\n",
"\n",
"input_audio = \"inference/input/test.mp3\"\n",
"\n",
"music2emo = Music2emo()\n",
"output_dic = music2emo.predict(input_audio)\n",
"\n",
"valence = output_dic[\"valence\"]\n",
"arousal = output_dic[\"arousal\"]\n",
"predicted_moods =output_dic[\"predicted_moods\"]\n",
"\n",
"print(\"\\nπ΅ **Music Emotion Recognition Results** π΅\")\n",
"print(\"-\" * 50)\n",
"print(f\"π **Predicted Mood Tags:** {', '.join(predicted_moods) if predicted_moods else 'None'}\")\n",
"print(f\"π **Valence:** {valence:.2f} (Scale: 1-9)\")\n",
"print(f\"β‘ **Arousal:** {arousal:.2f} (Scale: 1-9)\")\n",
"print(\"-\" * 50)\n",
"\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "music2emo",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
|