{"cells":[{"cell_type":"code","execution_count":1,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":22492,"status":"ok","timestamp":1669836388167,"user":{"displayName":"Rahul Dagar","userId":"06679238259044443515"},"user_tz":300},"id":"KNRGKEn0EUl5","outputId":"0410fe39-f705-4a78-b8b5-556e71b140c0"},"outputs":[{"output_type":"stream","name":"stdout","text":["Mounted at /content/drive\n"]}],"source":["from google.colab import drive\n","drive.mount('/content/drive')"]},{"cell_type":"code","execution_count":2,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":23597,"status":"ok","timestamp":1669836411747,"user":{"displayName":"Rahul Dagar","userId":"06679238259044443515"},"user_tz":300},"id":"tENqMaj5EZhe","outputId":"2d580757-f02d-4cf1-bd8f-64f7083efef7"},"outputs":[{"output_type":"stream","name":"stdout","text":["Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n","Collecting gradio\n"," Downloading gradio-3.12.0-py3-none-any.whl (11.6 MB)\n","\u001b[K |████████████████████████████████| 11.6 MB 35.8 MB/s \n","\u001b[?25hRequirement already satisfied: fsspec in /usr/local/lib/python3.7/dist-packages (from gradio) (2022.11.0)\n","Collecting markdown-it-py[linkify,plugins]\n"," Downloading markdown_it_py-2.1.0-py3-none-any.whl (84 kB)\n","\u001b[K |████████████████████████████████| 84 kB 3.7 MB/s \n","\u001b[?25hRequirement already satisfied: pydantic in /usr/local/lib/python3.7/dist-packages (from gradio) (1.10.2)\n","Collecting paramiko\n"," Downloading paramiko-2.12.0-py2.py3-none-any.whl (213 kB)\n","\u001b[K |████████████████████████████████| 213 kB 89.1 MB/s \n","\u001b[?25hCollecting httpx\n"," Downloading httpx-0.23.1-py3-none-any.whl (84 kB)\n","\u001b[K |████████████████████████████████| 84 kB 3.7 MB/s \n","\u001b[?25hCollecting h11<0.13,>=0.11\n"," Downloading h11-0.12.0-py3-none-any.whl (54 kB)\n","\u001b[K |████████████████████████████████| 54 kB 3.7 MB/s \n","\u001b[?25hCollecting uvicorn\n"," Downloading uvicorn-0.20.0-py3-none-any.whl (56 kB)\n","\u001b[K |████████████████████████████████| 56 kB 5.6 MB/s \n","\u001b[?25hCollecting fastapi\n"," Downloading fastapi-0.88.0-py3-none-any.whl (55 kB)\n","\u001b[K |████████████████████████████████| 55 kB 4.4 MB/s \n","\u001b[?25hRequirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (from gradio) (1.3.5)\n","Collecting python-multipart\n"," Downloading python-multipart-0.0.5.tar.gz (32 kB)\n","Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from gradio) (1.21.6)\n","Collecting pycryptodome\n"," Downloading pycryptodome-3.16.0-cp35-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.3 MB)\n","\u001b[K |████████████████████████████████| 2.3 MB 62.6 MB/s \n","\u001b[?25hRequirement already satisfied: jinja2 in /usr/local/lib/python3.7/dist-packages (from gradio) (2.11.3)\n","Requirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from gradio) (3.2.2)\n","Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from gradio) (2.23.0)\n","Collecting websockets>=10.0\n"," Downloading websockets-10.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (106 kB)\n","\u001b[K |████████████████████████████████| 106 kB 65.4 MB/s \n","\u001b[?25hRequirement already satisfied: aiohttp in /usr/local/lib/python3.7/dist-packages (from gradio) (3.8.3)\n","Collecting pydub\n"," Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n","Requirement already satisfied: pyyaml in /usr/local/lib/python3.7/dist-packages (from gradio) (6.0)\n","Requirement already satisfied: pillow in /usr/local/lib/python3.7/dist-packages (from gradio) (7.1.2)\n","Collecting orjson\n"," Downloading orjson-3.8.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (278 kB)\n","\u001b[K |████████████████████████████████| 278 kB 74.8 MB/s \n","\u001b[?25hCollecting ffmpy\n"," Downloading ffmpy-0.3.0.tar.gz (4.8 kB)\n","Requirement already satisfied: charset-normalizer<3.0,>=2.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->gradio) (2.1.1)\n","Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.7/dist-packages (from aiohttp->gradio) (6.0.2)\n","Requirement already satisfied: asynctest==0.13.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->gradio) (0.13.0)\n","Requirement already satisfied: typing-extensions>=3.7.4 in /usr/local/lib/python3.7/dist-packages (from aiohttp->gradio) (4.1.1)\n","Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.7/dist-packages (from aiohttp->gradio) (4.0.2)\n","Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.7/dist-packages (from aiohttp->gradio) (1.3.1)\n","Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->gradio) (22.1.0)\n","Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->gradio) (1.8.1)\n","Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from aiohttp->gradio) (1.3.3)\n","Requirement already satisfied: idna>=2.0 in /usr/local/lib/python3.7/dist-packages (from yarl<2.0,>=1.0->aiohttp->gradio) (2.10)\n","Collecting starlette==0.22.0\n"," Downloading starlette-0.22.0-py3-none-any.whl (64 kB)\n","\u001b[K |████████████████████████████████| 64 kB 3.4 MB/s \n","\u001b[?25hCollecting anyio<5,>=3.4.0\n"," Downloading anyio-3.6.2-py3-none-any.whl (80 kB)\n","\u001b[K |████████████████████████████████| 80 kB 10.2 MB/s \n","\u001b[?25hCollecting sniffio>=1.1\n"," Downloading sniffio-1.3.0-py3-none-any.whl (10 kB)\n","Collecting httpcore<0.17.0,>=0.15.0\n"," Downloading httpcore-0.16.2-py3-none-any.whl (68 kB)\n","\u001b[K |████████████████████████████████| 68 kB 7.5 MB/s \n","\u001b[?25hRequirement already satisfied: certifi in /usr/local/lib/python3.7/dist-packages (from httpx->gradio) (2022.9.24)\n","Collecting rfc3986[idna2008]<2,>=1.3\n"," Downloading rfc3986-1.5.0-py2.py3-none-any.whl (31 kB)\n","Collecting httpcore<0.17.0,>=0.15.0\n"," Downloading httpcore-0.16.1-py3-none-any.whl (68 kB)\n","\u001b[K |████████████████████████████████| 68 kB 8.1 MB/s \n","\u001b[?25h Downloading httpcore-0.16.0-py3-none-any.whl (68 kB)\n","\u001b[K |████████████████████████████████| 68 kB 7.8 MB/s \n","\u001b[?25h Downloading httpcore-0.15.0-py3-none-any.whl (68 kB)\n","\u001b[K |████████████████████████████████| 68 kB 8.3 MB/s \n","\u001b[?25hRequirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/dist-packages (from jinja2->gradio) (2.0.1)\n","Collecting mdurl~=0.1\n"," Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)\n","Collecting linkify-it-py~=1.0\n"," Downloading linkify_it_py-1.0.3-py3-none-any.whl (19 kB)\n","Collecting mdit-py-plugins\n"," Downloading mdit_py_plugins-0.3.1-py3-none-any.whl (46 kB)\n","\u001b[K |████████████████████████████████| 46 kB 4.4 MB/s \n","\u001b[?25hCollecting uc-micro-py\n"," Downloading uc_micro_py-1.0.1-py3-none-any.whl (6.2 kB)\n","Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->gradio) (2.8.2)\n","Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->gradio) (0.11.0)\n","Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->gradio) (1.4.4)\n","Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->gradio) (3.0.9)\n","Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.1->matplotlib->gradio) (1.15.0)\n","Requirement already satisfied: pytz>=2017.3 in /usr/local/lib/python3.7/dist-packages (from pandas->gradio) (2022.6)\n","Collecting cryptography>=2.5\n"," Downloading cryptography-38.0.4-cp36-abi3-manylinux_2_24_x86_64.whl (4.0 MB)\n","\u001b[K |████████████████████████████████| 4.0 MB 50.2 MB/s \n","\u001b[?25hCollecting bcrypt>=3.1.3\n"," Downloading bcrypt-4.0.1-cp36-abi3-manylinux_2_24_x86_64.whl (593 kB)\n","\u001b[K |████████████████████████████████| 593 kB 63.7 MB/s \n","\u001b[?25hCollecting pynacl>=1.0.1\n"," Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB)\n","\u001b[K |████████████████████████████████| 856 kB 74.9 MB/s \n","\u001b[?25hRequirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.7/dist-packages (from cryptography>=2.5->paramiko->gradio) (1.15.1)\n","Requirement already satisfied: pycparser in /usr/local/lib/python3.7/dist-packages (from cffi>=1.12->cryptography>=2.5->paramiko->gradio) (2.21)\n","Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->gradio) (3.0.4)\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->gradio) (1.24.3)\n","Requirement already satisfied: click>=7.0 in /usr/local/lib/python3.7/dist-packages (from uvicorn->gradio) (7.1.2)\n","Building wheels for collected packages: ffmpy, python-multipart\n"," Building wheel for ffmpy (setup.py) ... \u001b[?25l\u001b[?25hdone\n"," Created wheel for ffmpy: filename=ffmpy-0.3.0-py3-none-any.whl size=4711 sha256=9d7d101507bb4bcde4acaa83a192b6cb544771f7d61e8e193353f1401aa4469d\n"," Stored in directory: /root/.cache/pip/wheels/13/e4/6c/e8059816e86796a597c6e6b0d4c880630f51a1fcfa0befd5e6\n"," Building wheel for python-multipart (setup.py) ... \u001b[?25l\u001b[?25hdone\n"," Created wheel for python-multipart: filename=python_multipart-0.0.5-py3-none-any.whl size=31678 sha256=e78918c1797ce35e37a94ddbec7bbf53775d69f255e8cd91b36d45f26f1a7fc9\n"," Stored in directory: /root/.cache/pip/wheels/2c/41/7c/bfd1c180534ffdcc0972f78c5758f89881602175d48a8bcd2c\n","Successfully built ffmpy python-multipart\n","Installing collected packages: sniffio, mdurl, uc-micro-py, rfc3986, markdown-it-py, h11, anyio, starlette, pynacl, mdit-py-plugins, linkify-it-py, httpcore, cryptography, bcrypt, websockets, uvicorn, python-multipart, pydub, pycryptodome, paramiko, orjson, httpx, ffmpy, fastapi, gradio\n","Successfully installed anyio-3.6.2 bcrypt-4.0.1 cryptography-38.0.4 fastapi-0.88.0 ffmpy-0.3.0 gradio-3.12.0 h11-0.12.0 httpcore-0.15.0 httpx-0.23.1 linkify-it-py-1.0.3 markdown-it-py-2.1.0 mdit-py-plugins-0.3.1 mdurl-0.1.2 orjson-3.8.2 paramiko-2.12.0 pycryptodome-3.16.0 pydub-0.25.1 pynacl-1.5.0 python-multipart-0.0.5 rfc3986-1.5.0 sniffio-1.3.0 starlette-0.22.0 uc-micro-py-1.0.1 uvicorn-0.20.0 websockets-10.4\n","Reading package lists... Done\n","Building dependency tree \n","Reading state information... Done\n","The following package was automatically installed and is no longer required:\n"," libnvidia-common-460\n","Use 'apt autoremove' to remove it.\n","The following additional packages will be installed:\n"," freepats libaudio2 timidity-daemon\n","Suggested packages:\n"," nas fluid-soundfont-gm fluid-soundfont-gs pmidi\n","The following NEW packages will be installed:\n"," freepats libaudio2 timidity timidity-daemon\n","0 upgraded, 4 newly installed, 0 to remove and 5 not upgraded.\n","Need to get 29.6 MB of archives.\n","After this operation, 35.7 MB of additional disk space will be used.\n","Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 freepats all 20060219-1 [29.0 MB]\n","Get:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 libaudio2 amd64 1.9.4-6 [50.3 kB]\n","Get:3 http://archive.ubuntu.com/ubuntu bionic/universe amd64 timidity amd64 2.13.2-41 [585 kB]\n","Get:4 http://archive.ubuntu.com/ubuntu bionic/universe amd64 timidity-daemon all 2.13.2-41 [5,984 B]\n","Fetched 29.6 MB in 0s (72.0 MB/s)\n","Selecting previously unselected package freepats.\n","(Reading database ... 123991 files and directories currently installed.)\n","Preparing to unpack .../freepats_20060219-1_all.deb ...\n","Unpacking freepats (20060219-1) ...\n","Selecting previously unselected package libaudio2:amd64.\n","Preparing to unpack .../libaudio2_1.9.4-6_amd64.deb ...\n","Unpacking libaudio2:amd64 (1.9.4-6) ...\n","Selecting previously unselected package timidity.\n","Preparing to unpack .../timidity_2.13.2-41_amd64.deb ...\n","Unpacking timidity (2.13.2-41) ...\n","Selecting previously unselected package timidity-daemon.\n","Preparing to unpack .../timidity-daemon_2.13.2-41_all.deb ...\n","Unpacking timidity-daemon (2.13.2-41) ...\n","Setting up freepats (20060219-1) ...\n","Setting up libaudio2:amd64 (1.9.4-6) ...\n","Setting up timidity (2.13.2-41) ...\n","Setting up timidity-daemon (2.13.2-41) ...\n","Adding group timidity....done\n","Adding system user timidity....done\n","Adding user `timidity' to group `audio' ...\n","Adding user timidity to group audio\n","Done.\n","invoke-rc.d: could not determine current runlevel\n","invoke-rc.d: policy-rc.d denied execution of stop.\n","invoke-rc.d: could not determine current runlevel\n","invoke-rc.d: policy-rc.d denied execution of start.\n","Processing triggers for man-db (2.8.3-2ubuntu0.1) ...\n","Processing triggers for libc-bin (2.27-3ubuntu1.6) ...\n","Processing triggers for systemd (237-3ubuntu10.56) ...\n"]}],"source":["!pip install gradio\n","!apt-get install timidity"]},{"cell_type":"code","execution_count":3,"metadata":{"id":"wN-kzFUKEgbe","executionInfo":{"status":"ok","timestamp":1669836413098,"user_tz":300,"elapsed":1359,"user":{"displayName":"Rahul Dagar","userId":"06679238259044443515"}}},"outputs":[],"source":["import gradio as gr\n","from pathlib import Path\n","import subprocess"]},{"cell_type":"code","execution_count":4,"metadata":{"id":"IiiTtEdTJtzD","executionInfo":{"status":"ok","timestamp":1669836413099,"user_tz":300,"elapsed":13,"user":{"displayName":"Rahul Dagar","userId":"06679238259044443515"}}},"outputs":[],"source":["def inference():\n"," base_path = \"/content/drive/MyDrive/FIRE_3rd Sem/music_gn/\"\n"," #path_mid_file -> Replace this with model generated file path\n"," path_mid_file = base_path + \"Comic_Relief.mid\"\n"," path_wav_file = base_path + \"output_comic.wav\"\n"," subprocess.call(['timidity', path_mid_file, \"-Ow\", \"-o\", path_wav_file])\n"," return Path(path_wav_file)"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":898},"id":"ZSGf7iKuj3Qc","outputId":"c76600ef-3b3d-4dc6-b6af-058503ff96e1"},"outputs":[{"metadata":{"tags":null},"name":"stderr","output_type":"stream","text":["/usr/local/lib/python3.7/dist-packages/gradio/outputs.py:81: UserWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\n"," \"Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\",\n"]},{"metadata":{"tags":null},"name":"stdout","output_type":"stream","text":["Colab notebook detected. This cell will run indefinitely so that you can see errors and logs. To turn off, set debug=False in launch().\n","Running on public URL: https://d1c7449a9e2180e2.gradio.app\n","\n","This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces\n"]},{"data":{"text/html":["
"],"text/plain":["