mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-01-23 13:35:12 +03:00
commit
bd68c24bae
@ -6,7 +6,7 @@
|
||||
"name": "VoiceChangerDemo",
|
||||
"provenance": [],
|
||||
"collapsed_sections": [],
|
||||
"authorship_tag": "ABX9TyNT6WJO/7PBaFoxZqBF/4bV",
|
||||
"authorship_tag": "ABX9TyN61W+ggltXSTbKbQl0Nhqq",
|
||||
"include_colab_link": true
|
||||
},
|
||||
"kernelspec": {
|
||||
@ -75,7 +75,7 @@
|
||||
"base_uri": "https://localhost:8080/"
|
||||
},
|
||||
"id": "vV1t7PBRm-o6",
|
||||
"outputId": "f2f4a0c8-4de4-4083-c18b-ab1ff197b331"
|
||||
"outputId": "5530154a-ec7d-456c-cb18-46622c2d44fe"
|
||||
},
|
||||
"execution_count": 1,
|
||||
"outputs": [
|
||||
@ -83,7 +83,7 @@
|
||||
"output_type": "stream",
|
||||
"name": "stdout",
|
||||
"text": [
|
||||
"Mon Sep 5 18:18:54 2022 \n",
|
||||
"Sun Sep 18 20:59:42 2022 \n",
|
||||
"+-----------------------------------------------------------------------------+\n",
|
||||
"| NVIDIA-SMI 460.32.03 Driver Version: 460.32.03 CUDA Version: 11.2 |\n",
|
||||
"|-------------------------------+----------------------+----------------------+\n",
|
||||
@ -92,7 +92,7 @@
|
||||
"| | | MIG M. |\n",
|
||||
"|===============================+======================+======================|\n",
|
||||
"| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 |\n",
|
||||
"| N/A 48C P8 9W / 70W | 0MiB / 15109MiB | 0% Default |\n",
|
||||
"| N/A 59C P8 12W / 70W | 0MiB / 15109MiB | 0% Default |\n",
|
||||
"| | | N/A |\n",
|
||||
"+-------------------------------+----------------------+----------------------+\n",
|
||||
" \n",
|
||||
@ -141,7 +141,7 @@
|
||||
"base_uri": "https://localhost:8080/"
|
||||
},
|
||||
"id": "2wxD-gRSMU5R",
|
||||
"outputId": "db09c354-222d-4d24-9134-7403d845c5f8"
|
||||
"outputId": "f0428546-9e08-46d4-941c-70825b6a897c"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
@ -180,7 +180,7 @@
|
||||
"base_uri": "https://localhost:8080/"
|
||||
},
|
||||
"id": "86wTFmqsNMnD",
|
||||
"outputId": "99fc98a8-4358-4db8-b263-6f3f83637fb6"
|
||||
"outputId": "6931d814-4238-416a-d001-8d45b3db5cec"
|
||||
},
|
||||
"execution_count": 4,
|
||||
"outputs": [
|
||||
@ -189,12 +189,12 @@
|
||||
"name": "stdout",
|
||||
"text": [
|
||||
"Cloning into 'voice-changer'...\n",
|
||||
"remote: Enumerating objects: 402, done.\u001b[K\n",
|
||||
"remote: Counting objects: 100% (124/124), done.\u001b[K\n",
|
||||
"remote: Compressing objects: 100% (94/94), done.\u001b[K\n",
|
||||
"remote: Total 402 (delta 48), reused 72 (delta 29), pack-reused 278\u001b[K\n",
|
||||
"Receiving objects: 100% (402/402), 21.10 MiB | 15.18 MiB/s, done.\n",
|
||||
"Resolving deltas: 100% (184/184), done.\n",
|
||||
"remote: Enumerating objects: 581, done.\u001b[K\n",
|
||||
"remote: Counting objects: 100% (165/165), done.\u001b[K\n",
|
||||
"remote: Compressing objects: 100% (131/131), done.\u001b[K\n",
|
||||
"remote: Total 581 (delta 63), reused 66 (delta 32), pack-reused 416\u001b[K\n",
|
||||
"Receiving objects: 100% (581/581), 23.57 MiB | 28.90 MiB/s, done.\n",
|
||||
"Resolving deltas: 100% (290/290), done.\n",
|
||||
"/content/voice-changer/demo\n"
|
||||
]
|
||||
}
|
||||
@ -214,12 +214,12 @@
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# (4-1) 設定ファイルの配置\n",
|
||||
"!cp ../template/setting_colab.json ../frontend/dist/assets/setting.json\n"
|
||||
"!cp ../template/setting_mmvc_colab.json ../frontend/dist/assets/setting.json\n"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "Bn4kV8TgXp8i"
|
||||
},
|
||||
"execution_count": 5,
|
||||
"execution_count": 6,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
@ -233,9 +233,9 @@
|
||||
"base_uri": "https://localhost:8080/"
|
||||
},
|
||||
"id": "pjxPsOOaXXTj",
|
||||
"outputId": "0d139a40-6ea4-439c-a401-e13a300afb42"
|
||||
"outputId": "4d89e777-f413-493b-d15e-eac4f5e2abc4"
|
||||
},
|
||||
"execution_count": 8,
|
||||
"execution_count": 7,
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "stream",
|
||||
@ -244,7 +244,7 @@
|
||||
"{\n",
|
||||
" \"app_title\": \"voice-changer\",\n",
|
||||
" \"majar_mode\": \"colab\",\n",
|
||||
" \"voice_changer_server_url\": \"./test\",\n",
|
||||
" \"voice_changer_server_url\": \"/test\",\n",
|
||||
" \"sample_rate\": 48000,\n",
|
||||
" \"buffer_size\": 1024,\n",
|
||||
" \"prefix_chunk_size\": 24,\n",
|
||||
@ -299,23 +299,20 @@
|
||||
"source": [
|
||||
"# (5) 設定ファイルの確認\n",
|
||||
"!apt-get install -y espeak libsndfile1-dev\n",
|
||||
"!pip install flask\n",
|
||||
"!pip install python-socketio\n",
|
||||
"!pip install eventlet\n",
|
||||
"!pip install unidecode\n",
|
||||
"!pip install phonemizer\n",
|
||||
"!pip install retry\n",
|
||||
"!pip install flask\n",
|
||||
"!pip install flask_cors\n"
|
||||
"!pip install fastapi\n",
|
||||
"!pip install uvicorn"
|
||||
],
|
||||
"metadata": {
|
||||
"colab": {
|
||||
"base_uri": "https://localhost:8080/"
|
||||
},
|
||||
"id": "LwZAAuqxX7yY",
|
||||
"outputId": "edc7b12d-4386-4045-9ac0-04db2cb1874f"
|
||||
"outputId": "42437bdf-d619-4384-fba7-7948f26b272a"
|
||||
},
|
||||
"execution_count": 9,
|
||||
"execution_count": 8,
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "stream",
|
||||
@ -340,9 +337,9 @@
|
||||
"Get:3 http://archive.ubuntu.com/ubuntu bionic/universe amd64 espeak-data amd64 1.48.04+dfsg-5 [934 kB]\n",
|
||||
"Get:4 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libespeak1 amd64 1.48.04+dfsg-5 [145 kB]\n",
|
||||
"Get:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 espeak amd64 1.48.04+dfsg-5 [61.6 kB]\n",
|
||||
"Fetched 1,219 kB in 1s (1,458 kB/s)\n",
|
||||
"Fetched 1,219 kB in 1s (2,360 kB/s)\n",
|
||||
"Selecting previously unselected package libportaudio2:amd64.\n",
|
||||
"(Reading database ... 155685 files and directories currently installed.)\n",
|
||||
"(Reading database ... 155569 files and directories currently installed.)\n",
|
||||
"Preparing to unpack .../libportaudio2_19.6.0-1_amd64.deb ...\n",
|
||||
"Unpacking libportaudio2:amd64 (19.6.0-1) ...\n",
|
||||
"Selecting previously unselected package libsonic0:amd64.\n",
|
||||
@ -366,115 +363,115 @@
|
||||
"Processing triggers for libc-bin (2.27-3ubuntu1.5) ...\n",
|
||||
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
|
||||
"Requirement already satisfied: flask in /usr/local/lib/python3.7/dist-packages (1.1.4)\n",
|
||||
"Requirement already satisfied: Werkzeug<2.0,>=0.15 in /usr/local/lib/python3.7/dist-packages (from flask) (1.0.1)\n",
|
||||
"Requirement already satisfied: Jinja2<3.0,>=2.10.1 in /usr/local/lib/python3.7/dist-packages (from flask) (2.11.3)\n",
|
||||
"Requirement already satisfied: click<8.0,>=5.1 in /usr/local/lib/python3.7/dist-packages (from flask) (7.1.2)\n",
|
||||
"Requirement already satisfied: Werkzeug<2.0,>=0.15 in /usr/local/lib/python3.7/dist-packages (from flask) (1.0.1)\n",
|
||||
"Requirement already satisfied: itsdangerous<2.0,>=0.24 in /usr/local/lib/python3.7/dist-packages (from flask) (1.1.0)\n",
|
||||
"Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/dist-packages (from Jinja2<3.0,>=2.10.1->flask) (2.0.1)\n",
|
||||
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
|
||||
"Collecting python-socketio\n",
|
||||
" Downloading python_socketio-5.7.1-py3-none-any.whl (56 kB)\n",
|
||||
"\u001b[K |████████████████████████████████| 56 kB 2.7 MB/s \n",
|
||||
"\u001b[?25hCollecting python-engineio>=4.3.0\n",
|
||||
" Downloading python_engineio-4.3.4-py3-none-any.whl (52 kB)\n",
|
||||
"\u001b[K |████████████████████████████████| 52 kB 1.1 MB/s \n",
|
||||
"\u001b[?25hCollecting bidict>=0.21.0\n",
|
||||
" Downloading bidict-0.22.0-py3-none-any.whl (36 kB)\n",
|
||||
"Installing collected packages: python-engineio, bidict, python-socketio\n",
|
||||
"Collecting python-engineio>=4.3.0\n",
|
||||
" Downloading python_engineio-4.3.4-py3-none-any.whl (52 kB)\n",
|
||||
"\u001b[K |████████████████████████████████| 52 kB 1.8 MB/s \n",
|
||||
"\u001b[?25hInstalling collected packages: python-engineio, bidict, python-socketio\n",
|
||||
"Successfully installed bidict-0.22.0 python-engineio-4.3.4 python-socketio-5.7.1\n",
|
||||
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
|
||||
"Collecting eventlet\n",
|
||||
" Downloading eventlet-0.33.1-py2.py3-none-any.whl (226 kB)\n",
|
||||
"\u001b[K |████████████████████████████████| 226 kB 15.0 MB/s \n",
|
||||
"\u001b[K |████████████████████████████████| 226 kB 4.7 MB/s \n",
|
||||
"\u001b[?25hRequirement already satisfied: greenlet>=0.3 in /usr/local/lib/python3.7/dist-packages (from eventlet) (1.1.3)\n",
|
||||
"Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python3.7/dist-packages (from eventlet) (1.15.0)\n",
|
||||
"Collecting dnspython>=1.15.0\n",
|
||||
" Downloading dnspython-2.2.1-py3-none-any.whl (269 kB)\n",
|
||||
"\u001b[K |████████████████████████████████| 269 kB 63.6 MB/s \n",
|
||||
"\u001b[K |████████████████████████████████| 269 kB 61.5 MB/s \n",
|
||||
"\u001b[?25hInstalling collected packages: dnspython, eventlet\n",
|
||||
"Successfully installed dnspython-2.2.1 eventlet-0.33.1\n",
|
||||
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
|
||||
"Collecting unidecode\n",
|
||||
" Downloading Unidecode-1.3.4-py3-none-any.whl (235 kB)\n",
|
||||
"\u001b[K |████████████████████████████████| 235 kB 14.2 MB/s \n",
|
||||
"\u001b[K |████████████████████████████████| 235 kB 4.9 MB/s \n",
|
||||
"\u001b[?25hInstalling collected packages: unidecode\n",
|
||||
"Successfully installed unidecode-1.3.4\n",
|
||||
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
|
||||
"Collecting phonemizer\n",
|
||||
" Downloading phonemizer-3.2.1-py3-none-any.whl (90 kB)\n",
|
||||
"\u001b[K |████████████████████████████████| 90 kB 5.7 MB/s \n",
|
||||
"\u001b[?25hRequirement already satisfied: attrs>=18.1 in /usr/local/lib/python3.7/dist-packages (from phonemizer) (22.1.0)\n",
|
||||
"Collecting segments\n",
|
||||
" Downloading segments-2.2.1-py2.py3-none-any.whl (15 kB)\n",
|
||||
"Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from phonemizer) (4.1.1)\n",
|
||||
"Requirement already satisfied: joblib in /usr/local/lib/python3.7/dist-packages (from phonemizer) (1.1.0)\n",
|
||||
"\u001b[K |████████████████████████████████| 90 kB 4.0 MB/s \n",
|
||||
"\u001b[?25hRequirement already satisfied: joblib in /usr/local/lib/python3.7/dist-packages (from phonemizer) (1.1.0)\n",
|
||||
"Collecting dlinfo\n",
|
||||
" Downloading dlinfo-1.2.1-py3-none-any.whl (3.6 kB)\n",
|
||||
"Requirement already satisfied: regex in /usr/local/lib/python3.7/dist-packages (from segments->phonemizer) (2022.6.2)\n",
|
||||
"Collecting segments\n",
|
||||
" Downloading segments-2.2.1-py2.py3-none-any.whl (15 kB)\n",
|
||||
"Requirement already satisfied: attrs>=18.1 in /usr/local/lib/python3.7/dist-packages (from phonemizer) (22.1.0)\n",
|
||||
"Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from phonemizer) (4.1.1)\n",
|
||||
"Collecting clldutils>=1.7.3\n",
|
||||
" Downloading clldutils-3.12.0-py2.py3-none-any.whl (197 kB)\n",
|
||||
"\u001b[K |████████████████████████████████| 197 kB 29.6 MB/s \n",
|
||||
"\u001b[?25hRequirement already satisfied: regex in /usr/local/lib/python3.7/dist-packages (from segments->phonemizer) (2022.6.2)\n",
|
||||
"Collecting csvw>=1.5.6\n",
|
||||
" Downloading csvw-3.1.1-py2.py3-none-any.whl (56 kB)\n",
|
||||
"\u001b[K |████████████████████████████████| 56 kB 3.9 MB/s \n",
|
||||
"\u001b[?25hCollecting clldutils>=1.7.3\n",
|
||||
" Downloading clldutils-3.12.0-py2.py3-none-any.whl (197 kB)\n",
|
||||
"\u001b[K |████████████████████████████████| 197 kB 67.1 MB/s \n",
|
||||
"\u001b[K |████████████████████████████████| 56 kB 5.3 MB/s \n",
|
||||
"\u001b[?25hRequirement already satisfied: tabulate>=0.7.7 in /usr/local/lib/python3.7/dist-packages (from clldutils>=1.7.3->segments->phonemizer) (0.8.10)\n",
|
||||
"Requirement already satisfied: python-dateutil in /usr/local/lib/python3.7/dist-packages (from clldutils>=1.7.3->segments->phonemizer) (2.8.2)\n",
|
||||
"Collecting colorlog\n",
|
||||
" Downloading colorlog-6.7.0-py2.py3-none-any.whl (11 kB)\n",
|
||||
"Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from csvw>=1.5.6->segments->phonemizer) (2.23.0)\n",
|
||||
"Collecting colorama\n",
|
||||
" Downloading colorama-0.4.5-py2.py3-none-any.whl (16 kB)\n",
|
||||
"Requirement already satisfied: uritemplate>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from csvw>=1.5.6->segments->phonemizer) (3.0.1)\n",
|
||||
"Collecting rfc3986<2\n",
|
||||
" Downloading rfc3986-1.5.0-py2.py3-none-any.whl (31 kB)\n",
|
||||
"Collecting isodate\n",
|
||||
" Downloading isodate-0.6.1-py2.py3-none-any.whl (41 kB)\n",
|
||||
"\u001b[K |████████████████████████████████| 41 kB 498 kB/s \n",
|
||||
"\u001b[?25hCollecting rdflib\n",
|
||||
" Downloading rdflib-6.2.0-py3-none-any.whl (500 kB)\n",
|
||||
"\u001b[K |████████████████████████████████| 500 kB 65.3 MB/s \n",
|
||||
"\u001b[?25hRequirement already satisfied: babel in /usr/local/lib/python3.7/dist-packages (from csvw>=1.5.6->segments->phonemizer) (2.10.3)\n",
|
||||
"Requirement already satisfied: jsonschema in /usr/local/lib/python3.7/dist-packages (from csvw>=1.5.6->segments->phonemizer) (4.3.3)\n",
|
||||
"\u001b[K |████████████████████████████████| 41 kB 641 kB/s \n",
|
||||
"\u001b[?25hRequirement already satisfied: uritemplate>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from csvw>=1.5.6->segments->phonemizer) (3.0.1)\n",
|
||||
"Requirement already satisfied: babel in /usr/local/lib/python3.7/dist-packages (from csvw>=1.5.6->segments->phonemizer) (2.10.3)\n",
|
||||
"Collecting colorama\n",
|
||||
" Downloading colorama-0.4.5-py2.py3-none-any.whl (16 kB)\n",
|
||||
"Collecting language-tags\n",
|
||||
" Downloading language_tags-1.1.0-py2.py3-none-any.whl (210 kB)\n",
|
||||
"\u001b[K |████████████████████████████████| 210 kB 76.9 MB/s \n",
|
||||
"\u001b[?25hRequirement already satisfied: pytz>=2015.7 in /usr/local/lib/python3.7/dist-packages (from babel->csvw>=1.5.6->segments->phonemizer) (2022.2.1)\n",
|
||||
"\u001b[K |████████████████████████████████| 210 kB 57.8 MB/s \n",
|
||||
"\u001b[?25hRequirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from csvw>=1.5.6->segments->phonemizer) (2.23.0)\n",
|
||||
"Collecting rfc3986<2\n",
|
||||
" Downloading rfc3986-1.5.0-py2.py3-none-any.whl (31 kB)\n",
|
||||
"Collecting rdflib\n",
|
||||
" Downloading rdflib-6.2.0-py3-none-any.whl (500 kB)\n",
|
||||
"\u001b[K |████████████████████████████████| 500 kB 48.6 MB/s \n",
|
||||
"\u001b[?25hRequirement already satisfied: jsonschema in /usr/local/lib/python3.7/dist-packages (from csvw>=1.5.6->segments->phonemizer) (4.3.3)\n",
|
||||
"Requirement already satisfied: pytz>=2015.7 in /usr/local/lib/python3.7/dist-packages (from babel->csvw>=1.5.6->segments->phonemizer) (2022.2.1)\n",
|
||||
"Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from isodate->csvw>=1.5.6->segments->phonemizer) (1.15.0)\n",
|
||||
"Requirement already satisfied: importlib-resources>=1.4.0 in /usr/local/lib/python3.7/dist-packages (from jsonschema->csvw>=1.5.6->segments->phonemizer) (5.9.0)\n",
|
||||
"Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.7/dist-packages (from jsonschema->csvw>=1.5.6->segments->phonemizer) (4.12.0)\n",
|
||||
"Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /usr/local/lib/python3.7/dist-packages (from jsonschema->csvw>=1.5.6->segments->phonemizer) (0.18.1)\n",
|
||||
"Requirement already satisfied: importlib-resources>=1.4.0 in /usr/local/lib/python3.7/dist-packages (from jsonschema->csvw>=1.5.6->segments->phonemizer) (5.9.0)\n",
|
||||
"Requirement already satisfied: zipp>=3.1.0 in /usr/local/lib/python3.7/dist-packages (from importlib-resources>=1.4.0->jsonschema->csvw>=1.5.6->segments->phonemizer) (3.8.1)\n",
|
||||
"Requirement already satisfied: pyparsing in /usr/local/lib/python3.7/dist-packages (from rdflib->csvw>=1.5.6->segments->phonemizer) (3.0.9)\n",
|
||||
"Requirement already satisfied: setuptools in /usr/local/lib/python3.7/dist-packages (from rdflib->csvw>=1.5.6->segments->phonemizer) (57.4.0)\n",
|
||||
"Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->csvw>=1.5.6->segments->phonemizer) (3.0.4)\n",
|
||||
"Requirement already satisfied: pyparsing in /usr/local/lib/python3.7/dist-packages (from rdflib->csvw>=1.5.6->segments->phonemizer) (3.0.9)\n",
|
||||
"Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->csvw>=1.5.6->segments->phonemizer) (2.10)\n",
|
||||
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->csvw>=1.5.6->segments->phonemizer) (2022.6.15)\n",
|
||||
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->csvw>=1.5.6->segments->phonemizer) (1.24.3)\n",
|
||||
"Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->csvw>=1.5.6->segments->phonemizer) (3.0.4)\n",
|
||||
"Installing collected packages: isodate, rfc3986, rdflib, language-tags, colorama, csvw, colorlog, clldutils, segments, dlinfo, phonemizer\n",
|
||||
"Successfully installed clldutils-3.12.0 colorama-0.4.5 colorlog-6.7.0 csvw-3.1.1 dlinfo-1.2.1 isodate-0.6.1 language-tags-1.1.0 phonemizer-3.2.1 rdflib-6.2.0 rfc3986-1.5.0 segments-2.2.1\n",
|
||||
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
|
||||
"Collecting retry\n",
|
||||
" Downloading retry-0.9.2-py2.py3-none-any.whl (8.0 kB)\n",
|
||||
"Requirement already satisfied: py<2.0.0,>=1.4.26 in /usr/local/lib/python3.7/dist-packages (from retry) (1.11.0)\n",
|
||||
"Requirement already satisfied: decorator>=3.4.2 in /usr/local/lib/python3.7/dist-packages (from retry) (4.4.2)\n",
|
||||
"Requirement already satisfied: py<2.0.0,>=1.4.26 in /usr/local/lib/python3.7/dist-packages (from retry) (1.11.0)\n",
|
||||
"Installing collected packages: retry\n",
|
||||
"Successfully installed retry-0.9.2\n",
|
||||
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
|
||||
"Requirement already satisfied: flask in /usr/local/lib/python3.7/dist-packages (1.1.4)\n",
|
||||
"Requirement already satisfied: click<8.0,>=5.1 in /usr/local/lib/python3.7/dist-packages (from flask) (7.1.2)\n",
|
||||
"Requirement already satisfied: Jinja2<3.0,>=2.10.1 in /usr/local/lib/python3.7/dist-packages (from flask) (2.11.3)\n",
|
||||
"Requirement already satisfied: itsdangerous<2.0,>=0.24 in /usr/local/lib/python3.7/dist-packages (from flask) (1.1.0)\n",
|
||||
"Requirement already satisfied: Werkzeug<2.0,>=0.15 in /usr/local/lib/python3.7/dist-packages (from flask) (1.0.1)\n",
|
||||
"Requirement already satisfied: click<8.0,>=5.1 in /usr/local/lib/python3.7/dist-packages (from flask) (7.1.2)\n",
|
||||
"Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/dist-packages (from Jinja2<3.0,>=2.10.1->flask) (2.0.1)\n",
|
||||
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
|
||||
"Collecting flask_cors\n",
|
||||
" Downloading Flask_Cors-3.0.10-py2.py3-none-any.whl (14 kB)\n",
|
||||
"Requirement already satisfied: Flask>=0.9 in /usr/local/lib/python3.7/dist-packages (from flask_cors) (1.1.4)\n",
|
||||
"Requirement already satisfied: Six in /usr/local/lib/python3.7/dist-packages (from flask_cors) (1.15.0)\n",
|
||||
"Requirement already satisfied: Jinja2<3.0,>=2.10.1 in /usr/local/lib/python3.7/dist-packages (from Flask>=0.9->flask_cors) (2.11.3)\n",
|
||||
"Requirement already satisfied: itsdangerous<2.0,>=0.24 in /usr/local/lib/python3.7/dist-packages (from Flask>=0.9->flask_cors) (1.1.0)\n",
|
||||
"Requirement already satisfied: Werkzeug<2.0,>=0.15 in /usr/local/lib/python3.7/dist-packages (from Flask>=0.9->flask_cors) (1.0.1)\n",
|
||||
"Requirement already satisfied: Flask>=0.9 in /usr/local/lib/python3.7/dist-packages (from flask_cors) (1.1.4)\n",
|
||||
"Requirement already satisfied: click<8.0,>=5.1 in /usr/local/lib/python3.7/dist-packages (from Flask>=0.9->flask_cors) (7.1.2)\n",
|
||||
"Requirement already satisfied: Werkzeug<2.0,>=0.15 in /usr/local/lib/python3.7/dist-packages (from Flask>=0.9->flask_cors) (1.0.1)\n",
|
||||
"Requirement already satisfied: itsdangerous<2.0,>=0.24 in /usr/local/lib/python3.7/dist-packages (from Flask>=0.9->flask_cors) (1.1.0)\n",
|
||||
"Requirement already satisfied: Jinja2<3.0,>=2.10.1 in /usr/local/lib/python3.7/dist-packages (from Flask>=0.9->flask_cors) (2.11.3)\n",
|
||||
"Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/dist-packages (from Jinja2<3.0,>=2.10.1->Flask>=0.9->flask_cors) (2.0.1)\n",
|
||||
"Installing collected packages: flask-cors\n",
|
||||
"Successfully installed flask-cors-3.0.10\n"
|
||||
@ -525,12 +522,13 @@
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# (6-1) サーバの起動\n",
|
||||
"get_ipython().system_raw(f'python3 serverFlask.py 8082 {CONFIG} {MODEL} >foo 2>&1 &')"
|
||||
"PORT=8088\n",
|
||||
"get_ipython().system_raw(f'python3 serverFlask.py {PORT} {CONFIG} {MODEL} >foo 2>&1 &')"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "iNOAB7zISI6J"
|
||||
},
|
||||
"execution_count": 10,
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
@ -546,7 +544,7 @@
|
||||
"id": "chu06KpAjEK6",
|
||||
"outputId": "58a7c911-9fff-489e-c5a7-221b89d4039a"
|
||||
},
|
||||
"execution_count": 16,
|
||||
"execution_count": null,
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "stream",
|
||||
@ -590,9 +588,9 @@
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# (7) プロキシを起動\n",
|
||||
"from google.colab import output\n",
|
||||
"\n",
|
||||
"output.serve_kernel_port_as_window(8082)"
|
||||
"from google.colab.output import eval_js\n",
|
||||
"proxy = eval_js( \"google.colab.kernel.proxyPort(\" + str(PORT) + \")\" )\n",
|
||||
"print(f\"{proxy}front/\")"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "nkRjZm95l87C",
|
||||
@ -602,7 +600,7 @@
|
||||
},
|
||||
"outputId": "3c8be286-c4e2-4556-a709-44d79a8e1ce8"
|
||||
},
|
||||
"execution_count": 17,
|
||||
"execution_count": null,
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "display_data",
|
||||
|
@ -1,17 +1,17 @@
|
||||
from flask import Flask, request, Markup, abort, jsonify, send_from_directory
|
||||
from flask_cors import CORS
|
||||
import uvicorn
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from pydantic import BaseModel
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
import logging
|
||||
from logging.config import dictConfig
|
||||
import sys
|
||||
import base64
|
||||
import os, sys, base64, traceback, struct
|
||||
|
||||
import torch
|
||||
import numpy as np
|
||||
from scipy.io.wavfile import write, read
|
||||
from datetime import datetime
|
||||
|
||||
import traceback
|
||||
import struct
|
||||
|
||||
sys.path.append("mod")
|
||||
sys.path.append("mod/text")
|
||||
@ -21,32 +21,6 @@ from data_utils import TextAudioSpeakerLoader, TextAudioSpeakerCollate
|
||||
from models import SynthesizerTrn
|
||||
from text.symbols import symbols
|
||||
|
||||
dictConfig({
|
||||
'version': 1,
|
||||
'formatters': {'default': {
|
||||
'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s',
|
||||
}},
|
||||
'handlers': {'wsgi': {
|
||||
'class': 'logging.StreamHandler',
|
||||
'stream': 'ext://flask.logging.wsgi_errors_stream',
|
||||
'formatter': 'default'
|
||||
}},
|
||||
'root': {
|
||||
'level': 'INFO',
|
||||
'handlers': ['wsgi']
|
||||
}
|
||||
})
|
||||
|
||||
app = Flask(__name__)
|
||||
@app.route("/<path:path>")
|
||||
def static_dir(path):
|
||||
return send_from_directory("../frontend/dist", path)
|
||||
|
||||
@app.route('/', methods=['GET'])
|
||||
def redirect_to_index():
|
||||
return send_from_directory("../frontend/dist", 'index.html')
|
||||
|
||||
CORS(app, resources={r"/*": {"origins": "*"}})
|
||||
|
||||
class VoiceChanger():
|
||||
def __init__(self, config, model):
|
||||
@ -96,49 +70,76 @@ class VoiceChanger():
|
||||
return audio1
|
||||
|
||||
|
||||
logger = logging.getLogger('uvicorn')
|
||||
|
||||
@app.route('/test', methods=['GET', 'POST'])
|
||||
def test():
|
||||
args = sys.argv
|
||||
PORT = args[1]
|
||||
CONFIG = args[2]
|
||||
MODEL = args[3]
|
||||
logger.info('INITIALIZE MODEL')
|
||||
voiceChanger = VoiceChanger(CONFIG, MODEL)
|
||||
voiceChanger.on_request(0,0,0,0,0)
|
||||
|
||||
|
||||
|
||||
app = FastAPI()
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
app.mount("/front", StaticFiles(directory="../frontend/dist", html=True), name="static")
|
||||
|
||||
@app.get("/test")
|
||||
def get_test():
|
||||
try:
|
||||
if request.method == 'GET':
|
||||
return request.args.get('query', '')
|
||||
elif request.method == 'POST':
|
||||
print("POST REQUEST PROCESSING....")
|
||||
gpu = int(request.json['gpu'])
|
||||
srcId = int(request.json['srcId'])
|
||||
dstId = int(request.json['dstId'])
|
||||
timestamp = int(request.json['timestamp'])
|
||||
buffer = request.json['buffer']
|
||||
wav = base64.b64decode(buffer)
|
||||
# print(wav)
|
||||
# print(base64.b64encode(wav))
|
||||
changedVoice = voiceChanger.on_request(gpu, srcId, dstId, timestamp, wav)
|
||||
changedVoiceBase64 = base64.b64encode(changedVoice).decode('utf-8')
|
||||
# print("changedVoice",changedVoice)
|
||||
# print("CV64",changedVoiceBase64)
|
||||
data = {
|
||||
"gpu":gpu,
|
||||
"srcId":srcId,
|
||||
"dstId":dstId,
|
||||
"timestamp":timestamp,
|
||||
"changedVoiceBase64":changedVoiceBase64
|
||||
}
|
||||
return jsonify(data)
|
||||
else:
|
||||
return abort(400)
|
||||
return request.args.get('query', '')
|
||||
except Exception as e:
|
||||
print("REQUEST PROCESSING!!!! EXCEPTION!!!", e)
|
||||
print(traceback.format_exc())
|
||||
return str(e)
|
||||
|
||||
class VoiceModel(BaseModel):
|
||||
gpu: int
|
||||
srcId: int
|
||||
dstId: int
|
||||
timestamp: int
|
||||
buffer: str
|
||||
|
||||
@app.post("/test")
|
||||
def post_test(voice:VoiceModel):
|
||||
global voiceChanger
|
||||
try:
|
||||
print("POST REQUEST PROCESSING....")
|
||||
gpu = voice.gpu
|
||||
srcId = voice.srcId
|
||||
dstId = voice.dstId
|
||||
timestamp = voice.timestamp
|
||||
buffer = voice.buffer
|
||||
wav = base64.b64decode(buffer)
|
||||
|
||||
changedVoice = voiceChanger.on_request(gpu, srcId, dstId, timestamp, wav)
|
||||
changedVoiceBase64 = base64.b64encode(changedVoice).decode('utf-8')
|
||||
|
||||
data = {
|
||||
"gpu":gpu,
|
||||
"srcId":srcId,
|
||||
"dstId":dstId,
|
||||
"timestamp":timestamp,
|
||||
"changedVoiceBase64":changedVoiceBase64
|
||||
}
|
||||
|
||||
json_compatible_item_data = jsonable_encoder(data)
|
||||
|
||||
return JSONResponse(content=json_compatible_item_data)
|
||||
except Exception as e:
|
||||
print("REQUEST PROCESSING!!!! EXCEPTION!!!", e)
|
||||
print(traceback.format_exc())
|
||||
return str(e)
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = sys.argv
|
||||
PORT = args[1]
|
||||
CONFIG = args[2]
|
||||
MODEL = args[3]
|
||||
app.logger.info('INITIALIZE MODEL')
|
||||
voiceChanger = VoiceChanger(CONFIG, MODEL)
|
||||
voiceChanger.on_request(0,0,0,0,0)
|
||||
app.logger.info('START APP')
|
||||
app.run(debug=True, host='0.0.0.0',port=PORT)
|
||||
logger.info('START APP')
|
||||
uvicorn.run(f"{os.path.basename(__file__)[:-3]}:app", host="0.0.0.0", port=int(PORT), reload=True)
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM dannadori/voice-changer-internal:20220919_045352 as front
|
||||
FROM dannadori/voice-changer-internal:20220919_060759 as front
|
||||
FROM debian:bullseye-slim as base
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
Loading…
Reference in New Issue
Block a user