"<b>Description:</b> This notebook contains a demo application of Emotion Recognition models trained on the IEMOCAP dataset using 4 basic emotions.<br/>\n",
"### Please run this code cell (click inside the cell and press `Ctrl + Enter`, or click on the `run icon` in the top left corner of the cell) as well\n",
" print(f'TER Electra small (IEMOCAP): {ter_electra_iemocap}')\n",
" print(f'TER Electra small (PsychExp): {ter_electra_psychexp}')\n",
" print('='*60)\n",
"\n",
" return mer_trill_electra"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "ETpnzv33QOzP"
},
"source": [
"### Record a speech\n",
"\n",
"Here you can record a sample of your speech. To record just execute the next cell by either hitting the `run icon` or by clicking inside of the cell and then press `Ctrl + Enter`. After you've sad something click on the button `Stop recording` to stop recording. \n",
"\n",
"<b>WARNING: ONLY 11 SECONDS OF YOUR SPEECH WILL BE USED, SO IF YOU WILL SPEAK LONGER THE AUDIO FILE WILL BE TRUNCATED, IF YOU WILL SPEAK LESS, IT IS FINE, THE AUDIO RECORDING WILL BE PADDED.</b>"
]
},
{
"cell_type": "code",
"metadata": {
"id": "RPTSXUW9u3Ak"
},
"source": [
"audio, sample_rate, audio_file = get_audio()\n",
"\n",
"print('Speech recorded!')"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "AhbvAYwJP2Ym"
},
"source": [
"#### Emotion recognition"
]
},
{
"cell_type": "code",
"metadata": {
"id": "QJ7Fcv6WJx2A"
},
"source": [
"pred_emotion = predict_emotion(audio_file)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "OEacJF59wbM4"
},
"source": [
"### Audio uploading\n",
"\n",
"You can test out the models by uploading `.wav` audio files and the models will try to predict emotions from them. Try it! \n",
"\n",
"<b>WARNING: ONLY 11 SECONDS OF THE AUDIO FILES WILL BE USED, SO IF YOU WILL SPEAK LONGER THE AUDIO FILE WILL BE TRUNCATED, IF YOU WILL SPEAK LESS, IT IS FINE, THE AUDIO RECORDING WILL BE PADDED.</b>"
]
},
{
"cell_type": "code",
"metadata": {
"id": "btlhd4b5wmjp"
},
"source": [
"from google.colab import files\n",
"\n",
"# Upload files\n",
"uploaded = files.upload()\n",
"# Wav files counter \n",
"i_num = 1\n",
"\n",
"for uf in uploaded.keys():\n",
" if '.wav' in uf:\n",
" print('User uploaded file \"{name}\" with length {length} bytes'.format(\n",