update PLCMOS api example with file name
This commit is contained in:
Родитель
f48f6f5089
Коммит
33b5701e6e
|
@ -10,12 +10,13 @@
|
|||
"import requests\n",
|
||||
"import soundfile as sf\n",
|
||||
"import base64\n",
|
||||
"import json"
|
||||
"import json\n",
|
||||
"import os"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 2,
|
||||
"id": "e9409bda",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
|
@ -27,7 +28,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 3,
|
||||
"id": "264141c9-1abb-420e-a183-4cf456bdb1b0",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
|
@ -37,7 +38,7 @@
|
|||
"'OK'"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
@ -50,21 +51,33 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 4,
|
||||
"id": "dbb11ef7",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"healed_path = \"challenge_data/test/healed_signals\"\n",
|
||||
"reference_path = \"challenge_data/test/clean_signals\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "f196d7fd-f8ec-4d80-81b3-68ef8a7c3f71",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"audio, sr = sf.read(\"healed_audio.wav\")\n",
|
||||
"in_name = \"40.wav\"\n",
|
||||
"audio, sr = sf.read(os.path.join(healed_path, in_name))\n",
|
||||
"assert sr == 16000\n",
|
||||
"\n",
|
||||
"audio_clean, sr = sf.read(r\"reference_audio.wav\")\n",
|
||||
"audio_clean, sr = sf.read(os.path.join(reference_path, in_name))\n",
|
||||
"assert sr == 16000"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 6,
|
||||
"id": "02c135f8-a2e9-4a84-886c-6b0a0e6bf827",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
|
@ -76,24 +89,24 @@
|
|||
"data = {\n",
|
||||
" \"degraded\": audio.tolist(), \n",
|
||||
" \"reference\": audio_clean.tolist(), \n",
|
||||
" \"filename\": \"ignored\"\n",
|
||||
" \"filename\": os.path.basename(in_name),\n",
|
||||
"}\n",
|
||||
"resp = requests.post(API_BASE_URL + \"score-plc\", data=json.dumps(data), headers=headers)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 7,
|
||||
"id": "15eeef35-ba7b-40df-b521-286c5d9f9969",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'model_version': 1, 'plc_mos': 2.966283917427063}"
|
||||
"{'model_version': 1, 'plc_mos': 1.7383243441581726}"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
@ -105,7 +118,7 @@
|
|||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "66af5df0-59d6-45ce-85bc-10512adcc08d",
|
||||
"id": "16e34607",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
@ -127,7 +140,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.12"
|
||||
"version": "3.8.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
Загрузка…
Ссылка в новой задаче