From 2524f394f204c9659f2a73b9b207afcdf0c6dbe1 Mon Sep 17 00:00:00 2001 From: Pratham Kumar Date: 2023年7月27日 21:04:56 +0530 Subject: [PATCH 1/3] taking input from new line --- Fibonacci_Sequence_Generator/Fibonacci.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Fibonacci_Sequence_Generator/Fibonacci.py b/Fibonacci_Sequence_Generator/Fibonacci.py index 3124ba493f..93f28ba13a 100644 --- a/Fibonacci_Sequence_Generator/Fibonacci.py +++ b/Fibonacci_Sequence_Generator/Fibonacci.py @@ -14,7 +14,7 @@ def fibo(n): n = 0 while n <= 0: - n = int(input("Enter how many terms you need in your Fibonacci Sequence: ")) + n = int(input("Enter how many terms you need in your Fibonacci Sequence: \n")) fib_sequence = fibo(n) print(", ".join(map(str, fib_sequence))) From 9184ffc375a951580397c086850bf4482f7c0295 Mon Sep 17 00:00:00 2001 From: Pratham Kumar <115283906+prathamkumar125@users.noreply.github.com> Date: Wed, 1 May 2024 02:43:04 +0530 Subject: [PATCH 2/3] Created using Colab --- Audio2Text_openAIWhisper.ipynb | 463 +++++++++++++++++++++++++++++++++ 1 file changed, 463 insertions(+) create mode 100644 Audio2Text_openAIWhisper.ipynb diff --git a/Audio2Text_openAIWhisper.ipynb b/Audio2Text_openAIWhisper.ipynb new file mode 100644 index 0000000000..964ba8e52d --- /dev/null +++ b/Audio2Text_openAIWhisper.ipynb @@ -0,0 +1,463 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\" + ] + }, + { + "cell_type": "code", + "source": [ + "from google.colab import drive\n", + "drive.mount('/content/drive')" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "wdBCZDBBnCth", + "outputId": "0b7f9d93-d8f6-45ac-c207-08aa3a3a3a5a" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Mounted at /content/drive\n" + ] + } + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "id": "ZsJUxc0aRsAf", + "outputId": "c5ee871a-8808-4265-88bd-8e91a2959389", + "colab": { + "base_uri": "https://localhost:8080/" + } + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + " Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n", + " Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n", + " Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.8/1.8 MB\u001b[0m \u001b[31m8.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25h Building wheel for openai-whisper (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n" + ] + } + ], + "source": [ + "! pip install git+https://github.com/openai/whisper.git -q" + ] + }, + { + "cell_type": "code", + "source": [ + "import whisper\n", + "\n", + "model = whisper.load_model(\"base\")\n" + ], + "metadata": { + "id": "Kr5faKybKi4p", + "outputId": "34d7955b-5694-4245-cba0-c48e17a2c8af", + "colab": { + "base_uri": "https://localhost:8080/" + } + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "name": "stderr", + "text": [ + "100%|████████████████████████████████████████| 139M/139M [00:01<00:00, 144MiB/s]\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "model.device" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "u_6_s2iHboR4", + "outputId": "4ec71b0b-bf10-4367-bcd3-669c16a3f595" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "device(type='cuda', index=0)" + ] + }, + "metadata": {}, + "execution_count": 4 + } + ] + }, + { + "cell_type": "code", + "source": [ + "!mkdir /content/dataset" + ], + "metadata": { + "id": "gRrZgQOXnywk" + }, + "execution_count": 17, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "!cp -r /content/drive/MyDrive/NLP/dataset_audio/* /content/dataset/" + ], + "metadata": { + "id": "_kuwF46ln8qt" + }, + "execution_count": 21, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "from IPython.display import Audio\n", + "Audio(\"/content/dataset/-7020799700.mp3\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "id": "fhLths-Nfn5Z", + "outputId": "53e237a4-c3cd-4f86-a0f4-6d3e2b7d2498" + }, + "execution_count": 22, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "\n", + " \n", + " " + ] + }, + "metadata": {}, + "execution_count": 22 + } + ] + }, + { + "cell_type": "code", + "source": [ + "\n", + "# load audio and pad/trim it to fit 30 seconds\n", + "audio = whisper.load_audio(\"/content/dataset/-7020799700.mp3\")\n", + "audio = whisper.pad_or_trim(audio)\n", + "\n", + "# make log-Mel spectrogram and move to the same device as the model\n", + "mel = whisper.log_mel_spectrogram(audio).to(model.device)\n", + "\n", + "# detect the spoken language\n", + "_, probs = model.detect_language(mel)\n", + "print(f\"Detected language: {max(probs, key=probs.get)}\")\n", + "\n", + "# decode the audio\n", + "options = whisper.DecodingOptions()\n", + "result = whisper.decode(model, mel, options)\n", + "\n", + "# print the recognized text\n", + "print(result.text)" + ], + "metadata": { + "id": "bDXgLIprIsAj", + "outputId": "2c4ec4bd-6045-4c32-89e3-2440053bd1aa", + "colab": { + "base_uri": "https://localhost:8080/" + } + }, + "execution_count": 23, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Detected language: hi\n", + "पाचे वो राचे वो नमशकार मैं पर साशनी सुदार वोग काचे वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "def transcribe(audio):\n", + "\n", + " #time.sleep(3)\n", + " # load audio and pad/trim it to fit 30 seconds\n", + " audio = whisper.load_audio(audio)\n", + " audio = whisper.pad_or_trim(audio)\n", + "\n", + " # make log-Mel spectrogram and move to the same device as the model\n", + " mel = whisper.log_mel_spectrogram(audio).to(model.device)\n", + "\n", + " # detect the spoken language\n", + " _, probs = model.detect_language(mel)\n", + " print(f\"Detected language: {max(probs, key=probs.get)}\")\n", + "\n", + " # decode the audio\n", + " options = whisper.DecodingOptions()\n", + " result = whisper.decode(model, mel, options)\n", + " return result.text\n" + ], + "metadata": { + "id": "JtTvvQQPcOZZ" + }, + "execution_count": 24, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "!pip install gradio==3.50" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "RZodfViPjB78", + "outputId": "e2ed1b01-2a52-4a4f-9b30-7d87b52b832c" + }, + "execution_count": 25, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Collecting gradio==3.50\n", + " Downloading gradio-3.50.0-py3-none-any.whl (20.3 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m20.3/20.3 MB\u001b[0m \u001b[31m48.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting aiofiles<24.0,>=22.0 (from gradio==3.50)\n", + " Downloading aiofiles-23.2.1-py3-none-any.whl (15 kB)\n", + "Requirement already satisfied: altair<6.0,>=4.2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (4.2.2)\n", + "Collecting fastapi (from gradio==3.50)\n", + " Downloading fastapi-0.110.3-py3-none-any.whl (91 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m91.8/91.8 kB\u001b[0m \u001b[31m15.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting ffmpy (from gradio==3.50)\n", + " Downloading ffmpy-0.3.2.tar.gz (5.5 kB)\n", + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "Collecting gradio-client==0.6.1 (from gradio==3.50)\n", + " Downloading gradio_client-0.6.1-py3-none-any.whl (299 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m299.2/299.2 kB\u001b[0m \u001b[31m36.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting httpx (from gradio==3.50)\n", + " Downloading httpx-0.27.0-py3-none-any.whl (75 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m75.6/75.6 kB\u001b[0m \u001b[31m13.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: huggingface-hub>=0.14.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (0.20.3)\n", + "Requirement already satisfied: importlib-resources<7.0,>=1.3 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (6.4.0)\n", + "Requirement already satisfied: jinja2<4.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (3.1.3)\n", + "Requirement already satisfied: markupsafe~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (2.1.5)\n", + "Requirement already satisfied: matplotlib~=3.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (3.7.1)\n", + "Requirement already satisfied: numpy~=1.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (1.25.2)\n", + "Collecting orjson~=3.0 (from gradio==3.50)\n", + " Downloading orjson-3.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (141 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m141.1/141.1 kB\u001b[0m \u001b[31m22.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (24.0)\n", + "Requirement already satisfied: pandas<3.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (2.0.3)\n", + "Requirement already satisfied: pillow<11.0,>=8.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (9.4.0)\n", + "Requirement already satisfied: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (2.7.1)\n", + "Collecting pydub (from gradio==3.50)\n", + " Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n", + "Collecting python-multipart (from gradio==3.50)\n", + " Downloading python_multipart-0.0.9-py3-none-any.whl (22 kB)\n", + "Requirement already satisfied: pyyaml<7.0,>=5.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (6.0.1)\n", + "Requirement already satisfied: requests~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (2.31.0)\n", + "Collecting semantic-version~=2.0 (from gradio==3.50)\n", + " Downloading semantic_version-2.10.0-py2.py3-none-any.whl (15 kB)\n", + "Requirement already satisfied: typing-extensions~=4.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (4.11.0)\n", + "Collecting uvicorn>=0.14.0 (from gradio==3.50)\n", + " Downloading uvicorn-0.29.0-py3-none-any.whl (60 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m60.8/60.8 kB\u001b[0m \u001b[31m10.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting websockets<12.0,>=10.0 (from gradio==3.50)\n", + " Downloading websockets-11.0.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (129 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m129.9/129.9 kB\u001b[0m \u001b[31m21.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from gradio-client==0.6.1->gradio==3.50) (202360)\n", + "Requirement already satisfied: entrypoints in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio==3.50) (0.4)\n", + "Requirement already satisfied: jsonschema>=3.0 in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio==3.50) (4.19.2)\n", + "Requirement already satisfied: toolz in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio==3.50) (0.12.1)\n", + "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.14.0->gradio==3.50) (3.13.4)\n", + "Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.14.0->gradio==3.50) (4.66.2)\n", + "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (1.2.1)\n", + "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (0.12.1)\n", + "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (4.51.0)\n", + "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (1.4.5)\n", + "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (3.1.2)\n", + "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (2.8.2)\n", + "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas<3.0,>=1.0->gradio==3.50) (2023.4)\n", + "Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas<3.0,>=1.0->gradio==3.50) (2024.1)\n", + "Requirement already satisfied: annotated-types>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4->gradio==3.50) (0.6.0)\n", + "Requirement already satisfied: pydantic-core==2.18.2 in /usr/local/lib/python3.10/dist-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4->gradio==3.50) (2.18.2)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.50) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.50) (3.7)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.50) (2.0.7)\n", + "Requirement already satisfied: certifi>=2017年4月17日 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.50) (2024年2月2日)\n", + "Requirement already satisfied: click>=7.0 in /usr/local/lib/python3.10/dist-packages (from uvicorn>=0.14.0->gradio==3.50) (8.1.7)\n", + "Collecting h11>=0.8 (from uvicorn>=0.14.0->gradio==3.50)\n", + " Downloading h11-0.14.0-py3-none-any.whl (58 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m10.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting starlette<0.38.0,>=0.37.2 (from fastapi->gradio==3.50)\n", + " Downloading starlette-0.37.2-py3-none-any.whl (71 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m71.9/71.9 kB\u001b[0m \u001b[31m11.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: anyio in /usr/local/lib/python3.10/dist-packages (from httpx->gradio==3.50) (3.7.1)\n", + "Collecting httpcore==1.* (from httpx->gradio==3.50)\n", + " Downloading httpcore-1.0.5-py3-none-any.whl (77 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m77.9/77.9 kB\u001b[0m \u001b[31m11.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from httpx->gradio==3.50) (1.3.1)\n", + "Requirement already satisfied: attrs>=22.2.0 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50) (23.2.0)\n", + "Requirement already satisfied: jsonschema-specifications>=2023年03月6日 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50) (2023年12月1日)\n", + "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50) (0.35.0)\n", + "Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50) (0.18.0)\n", + "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib~=3.0->gradio==3.50) (1.16.0)\n", + "Requirement already satisfied: exceptiongroup in /usr/local/lib/python3.10/dist-packages (from anyio->httpx->gradio==3.50) (1.2.1)\n", + "Building wheels for collected packages: ffmpy\n", + " Building wheel for ffmpy (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for ffmpy: filename=ffmpy-0.3.2-py3-none-any.whl size=5584 sha256=3923d4f61ba755046d42dc3b3b123484ae8a4797a09cd957cde7b907ce351678\n", + " Stored in directory: /root/.cache/pip/wheels/bd/65/9a/671fc6dcde07d4418df0c592f8df512b26d7a0029c2a23dd81\n", + "Successfully built ffmpy\n", + "Installing collected packages: pydub, ffmpy, websockets, semantic-version, python-multipart, orjson, h11, aiofiles, uvicorn, starlette, httpcore, httpx, fastapi, gradio-client, gradio\n", + "Successfully installed aiofiles-23.2.1 fastapi-0.110.3 ffmpy-0.3.2 gradio-3.50.0 gradio-client-0.6.1 h11-0.14.0 httpcore-1.0.5 httpx-0.27.0 orjson-3.10.1 pydub-0.25.1 python-multipart-0.0.9 semantic-version-2.10.0 starlette-0.37.2 uvicorn-0.29.0 websockets-11.0.3\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "import gradio as gr\n", + "import time" + ], + "metadata": { + "id": "ILFOYNnTcYe8" + }, + "execution_count": 26, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "gr.Interface(\n", + " title = 'OpenAI-Whisper Audio to Text Web UI',\n", + " fn=transcribe,\n", + " inputs=[\n", + " gr.inputs.Audio(source=\"microphone\", type=\"filepath\")\n", + " ],\n", + " outputs=[\n", + " \"textbox\"\n", + " ],\n", + " live=True).launch()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 718 + }, + "id": "deSAVvfJcWBo", + "outputId": "cb5cbdcd-bcf1-4cb2-d21a-d261b05244c2" + }, + "execution_count": 30, + "outputs": [ + { + "output_type": "stream", + "name": "stderr", + "text": [ + ":5: GradioDeprecationWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n", + " gr.inputs.Audio(source=\"microphone\", type=\"filepath\")\n", + ":5: GradioDeprecationWarning: `optional` parameter is deprecated, and it has no effect\n", + " gr.inputs.Audio(source=\"microphone\", type=\"filepath\")\n" + ] + }, + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Setting queue=True in a Colab notebook requires sharing enabled. Setting `share=True` (you can turn this off by setting `share=False` in `launch()` explicitly).\n", + "\n", + "Colab notebook detected. To show errors in colab notebook, set debug=True in launch()\n", + "Running on public URL: https://f833c50c0881778a6b.gradio.live\n", + "\n", + "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" + ] + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "" + ] + }, + "metadata": {} + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [] + }, + "metadata": {}, + "execution_count": 30 + } + ] + } + ], + "metadata": { + "accelerator": "GPU", + "colab": { + "provenance": [], + "include_colab_link": true + }, + "gpuClass": "standard", + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.9.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file From 4cd4aa6b58f0b66e7f3f65bcbdfcce0b696579b4 Mon Sep 17 00:00:00 2001 From: Pratham Kumar <115283906+prathamkumar125@users.noreply.github.com> Date: Wed, 1 May 2024 02:43:25 +0530 Subject: [PATCH 3/3] Delete Audio2Text_openAIWhisper.ipynb --- Audio2Text_openAIWhisper.ipynb | 463 --------------------------------- 1 file changed, 463 deletions(-) delete mode 100644 Audio2Text_openAIWhisper.ipynb diff --git a/Audio2Text_openAIWhisper.ipynb b/Audio2Text_openAIWhisper.ipynb deleted file mode 100644 index 964ba8e52d..0000000000 --- a/Audio2Text_openAIWhisper.ipynb +++ /dev/null @@ -1,463 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "view-in-github", - "colab_type": "text" - }, - "source": [ - "\" - ] - }, - { - "cell_type": "code", - "source": [ - "from google.colab import drive\n", - "drive.mount('/content/drive')" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "wdBCZDBBnCth", - "outputId": "0b7f9d93-d8f6-45ac-c207-08aa3a3a3a5a" - }, - "execution_count": 8, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Mounted at /content/drive\n" - ] - } - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "id": "ZsJUxc0aRsAf", - "outputId": "c5ee871a-8808-4265-88bd-8e91a2959389", - "colab": { - "base_uri": "https://localhost:8080/" - } - }, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - " Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n", - " Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n", - " Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.8/1.8 MB\u001b[0m \u001b[31m8.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25h Building wheel for openai-whisper (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n" - ] - } - ], - "source": [ - "! pip install git+https://github.com/openai/whisper.git -q" - ] - }, - { - "cell_type": "code", - "source": [ - "import whisper\n", - "\n", - "model = whisper.load_model(\"base\")\n" - ], - "metadata": { - "id": "Kr5faKybKi4p", - "outputId": "34d7955b-5694-4245-cba0-c48e17a2c8af", - "colab": { - "base_uri": "https://localhost:8080/" - } - }, - "execution_count": 3, - "outputs": [ - { - "output_type": "stream", - "name": "stderr", - "text": [ - "100%|████████████████████████████████████████| 139M/139M [00:01<00:00, 144MiB/s]\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "model.device" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "u_6_s2iHboR4", - "outputId": "4ec71b0b-bf10-4367-bcd3-669c16a3f595" - }, - "execution_count": 4, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/plain": [ - "device(type='cuda', index=0)" - ] - }, - "metadata": {}, - "execution_count": 4 - } - ] - }, - { - "cell_type": "code", - "source": [ - "!mkdir /content/dataset" - ], - "metadata": { - "id": "gRrZgQOXnywk" - }, - "execution_count": 17, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "!cp -r /content/drive/MyDrive/NLP/dataset_audio/* /content/dataset/" - ], - "metadata": { - "id": "_kuwF46ln8qt" - }, - "execution_count": 21, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "from IPython.display import Audio\n", - "Audio(\"/content/dataset/-7020799700.mp3\")" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "id": "fhLths-Nfn5Z", - "outputId": "53e237a4-c3cd-4f86-a0f4-6d3e2b7d2498" - }, - "execution_count": 22, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/plain": [ - "" - ], - "text/html": [ - "\n", - " \n", - " " - ] - }, - "metadata": {}, - "execution_count": 22 - } - ] - }, - { - "cell_type": "code", - "source": [ - "\n", - "# load audio and pad/trim it to fit 30 seconds\n", - "audio = whisper.load_audio(\"/content/dataset/-7020799700.mp3\")\n", - "audio = whisper.pad_or_trim(audio)\n", - "\n", - "# make log-Mel spectrogram and move to the same device as the model\n", - "mel = whisper.log_mel_spectrogram(audio).to(model.device)\n", - "\n", - "# detect the spoken language\n", - "_, probs = model.detect_language(mel)\n", - "print(f\"Detected language: {max(probs, key=probs.get)}\")\n", - "\n", - "# decode the audio\n", - "options = whisper.DecodingOptions()\n", - "result = whisper.decode(model, mel, options)\n", - "\n", - "# print the recognized text\n", - "print(result.text)" - ], - "metadata": { - "id": "bDXgLIprIsAj", - "outputId": "2c4ec4bd-6045-4c32-89e3-2440053bd1aa", - "colab": { - "base_uri": "https://localhost:8080/" - } - }, - "execution_count": 23, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Detected language: hi\n", - "पाचे वो राचे वो नमशकार मैं पर साशनी सुदार वोग काचे वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा वोगा\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "def transcribe(audio):\n", - "\n", - " #time.sleep(3)\n", - " # load audio and pad/trim it to fit 30 seconds\n", - " audio = whisper.load_audio(audio)\n", - " audio = whisper.pad_or_trim(audio)\n", - "\n", - " # make log-Mel spectrogram and move to the same device as the model\n", - " mel = whisper.log_mel_spectrogram(audio).to(model.device)\n", - "\n", - " # detect the spoken language\n", - " _, probs = model.detect_language(mel)\n", - " print(f\"Detected language: {max(probs, key=probs.get)}\")\n", - "\n", - " # decode the audio\n", - " options = whisper.DecodingOptions()\n", - " result = whisper.decode(model, mel, options)\n", - " return result.text\n" - ], - "metadata": { - "id": "JtTvvQQPcOZZ" - }, - "execution_count": 24, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "!pip install gradio==3.50" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "RZodfViPjB78", - "outputId": "e2ed1b01-2a52-4a4f-9b30-7d87b52b832c" - }, - "execution_count": 25, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Collecting gradio==3.50\n", - " Downloading gradio-3.50.0-py3-none-any.whl (20.3 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m20.3/20.3 MB\u001b[0m \u001b[31m48.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hCollecting aiofiles<24.0,>=22.0 (from gradio==3.50)\n", - " Downloading aiofiles-23.2.1-py3-none-any.whl (15 kB)\n", - "Requirement already satisfied: altair<6.0,>=4.2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (4.2.2)\n", - "Collecting fastapi (from gradio==3.50)\n", - " Downloading fastapi-0.110.3-py3-none-any.whl (91 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m91.8/91.8 kB\u001b[0m \u001b[31m15.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hCollecting ffmpy (from gradio==3.50)\n", - " Downloading ffmpy-0.3.2.tar.gz (5.5 kB)\n", - " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - "Collecting gradio-client==0.6.1 (from gradio==3.50)\n", - " Downloading gradio_client-0.6.1-py3-none-any.whl (299 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m299.2/299.2 kB\u001b[0m \u001b[31m36.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hCollecting httpx (from gradio==3.50)\n", - " Downloading httpx-0.27.0-py3-none-any.whl (75 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m75.6/75.6 kB\u001b[0m \u001b[31m13.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: huggingface-hub>=0.14.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (0.20.3)\n", - "Requirement already satisfied: importlib-resources<7.0,>=1.3 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (6.4.0)\n", - "Requirement already satisfied: jinja2<4.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (3.1.3)\n", - "Requirement already satisfied: markupsafe~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (2.1.5)\n", - "Requirement already satisfied: matplotlib~=3.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (3.7.1)\n", - "Requirement already satisfied: numpy~=1.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (1.25.2)\n", - "Collecting orjson~=3.0 (from gradio==3.50)\n", - " Downloading orjson-3.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (141 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m141.1/141.1 kB\u001b[0m \u001b[31m22.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (24.0)\n", - "Requirement already satisfied: pandas<3.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (2.0.3)\n", - "Requirement already satisfied: pillow<11.0,>=8.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (9.4.0)\n", - "Requirement already satisfied: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (2.7.1)\n", - "Collecting pydub (from gradio==3.50)\n", - " Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n", - "Collecting python-multipart (from gradio==3.50)\n", - " Downloading python_multipart-0.0.9-py3-none-any.whl (22 kB)\n", - "Requirement already satisfied: pyyaml<7.0,>=5.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (6.0.1)\n", - "Requirement already satisfied: requests~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (2.31.0)\n", - "Collecting semantic-version~=2.0 (from gradio==3.50)\n", - " Downloading semantic_version-2.10.0-py2.py3-none-any.whl (15 kB)\n", - "Requirement already satisfied: typing-extensions~=4.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (4.11.0)\n", - "Collecting uvicorn>=0.14.0 (from gradio==3.50)\n", - " Downloading uvicorn-0.29.0-py3-none-any.whl (60 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m60.8/60.8 kB\u001b[0m \u001b[31m10.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hCollecting websockets<12.0,>=10.0 (from gradio==3.50)\n", - " Downloading websockets-11.0.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (129 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m129.9/129.9 kB\u001b[0m \u001b[31m21.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from gradio-client==0.6.1->gradio==3.50) (202360)\n", - "Requirement already satisfied: entrypoints in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio==3.50) (0.4)\n", - "Requirement already satisfied: jsonschema>=3.0 in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio==3.50) (4.19.2)\n", - "Requirement already satisfied: toolz in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio==3.50) (0.12.1)\n", - "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.14.0->gradio==3.50) (3.13.4)\n", - "Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.14.0->gradio==3.50) (4.66.2)\n", - "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (1.2.1)\n", - "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (0.12.1)\n", - "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (4.51.0)\n", - "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (1.4.5)\n", - "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (3.1.2)\n", - "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (2.8.2)\n", - "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas<3.0,>=1.0->gradio==3.50) (2023.4)\n", - "Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas<3.0,>=1.0->gradio==3.50) (2024.1)\n", - "Requirement already satisfied: annotated-types>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4->gradio==3.50) (0.6.0)\n", - "Requirement already satisfied: pydantic-core==2.18.2 in /usr/local/lib/python3.10/dist-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4->gradio==3.50) (2.18.2)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.50) (3.3.2)\n", - "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.50) (3.7)\n", - "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.50) (2.0.7)\n", - "Requirement already satisfied: certifi>=2017年4月17日 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.50) (2024年2月2日)\n", - "Requirement already satisfied: click>=7.0 in /usr/local/lib/python3.10/dist-packages (from uvicorn>=0.14.0->gradio==3.50) (8.1.7)\n", - "Collecting h11>=0.8 (from uvicorn>=0.14.0->gradio==3.50)\n", - " Downloading h11-0.14.0-py3-none-any.whl (58 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m10.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hCollecting starlette<0.38.0,>=0.37.2 (from fastapi->gradio==3.50)\n", - " Downloading starlette-0.37.2-py3-none-any.whl (71 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m71.9/71.9 kB\u001b[0m \u001b[31m11.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: anyio in /usr/local/lib/python3.10/dist-packages (from httpx->gradio==3.50) (3.7.1)\n", - "Collecting httpcore==1.* (from httpx->gradio==3.50)\n", - " Downloading httpcore-1.0.5-py3-none-any.whl (77 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m77.9/77.9 kB\u001b[0m \u001b[31m11.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from httpx->gradio==3.50) (1.3.1)\n", - "Requirement already satisfied: attrs>=22.2.0 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50) (23.2.0)\n", - "Requirement already satisfied: jsonschema-specifications>=2023年03月6日 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50) (2023年12月1日)\n", - "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50) (0.35.0)\n", - "Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50) (0.18.0)\n", - "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib~=3.0->gradio==3.50) (1.16.0)\n", - "Requirement already satisfied: exceptiongroup in /usr/local/lib/python3.10/dist-packages (from anyio->httpx->gradio==3.50) (1.2.1)\n", - "Building wheels for collected packages: ffmpy\n", - " Building wheel for ffmpy (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - " Created wheel for ffmpy: filename=ffmpy-0.3.2-py3-none-any.whl size=5584 sha256=3923d4f61ba755046d42dc3b3b123484ae8a4797a09cd957cde7b907ce351678\n", - " Stored in directory: /root/.cache/pip/wheels/bd/65/9a/671fc6dcde07d4418df0c592f8df512b26d7a0029c2a23dd81\n", - "Successfully built ffmpy\n", - "Installing collected packages: pydub, ffmpy, websockets, semantic-version, python-multipart, orjson, h11, aiofiles, uvicorn, starlette, httpcore, httpx, fastapi, gradio-client, gradio\n", - "Successfully installed aiofiles-23.2.1 fastapi-0.110.3 ffmpy-0.3.2 gradio-3.50.0 gradio-client-0.6.1 h11-0.14.0 httpcore-1.0.5 httpx-0.27.0 orjson-3.10.1 pydub-0.25.1 python-multipart-0.0.9 semantic-version-2.10.0 starlette-0.37.2 uvicorn-0.29.0 websockets-11.0.3\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "import gradio as gr\n", - "import time" - ], - "metadata": { - "id": "ILFOYNnTcYe8" - }, - "execution_count": 26, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "gr.Interface(\n", - " title = 'OpenAI-Whisper Audio to Text Web UI',\n", - " fn=transcribe,\n", - " inputs=[\n", - " gr.inputs.Audio(source=\"microphone\", type=\"filepath\")\n", - " ],\n", - " outputs=[\n", - " \"textbox\"\n", - " ],\n", - " live=True).launch()" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 718 - }, - "id": "deSAVvfJcWBo", - "outputId": "cb5cbdcd-bcf1-4cb2-d21a-d261b05244c2" - }, - "execution_count": 30, - "outputs": [ - { - "output_type": "stream", - "name": "stderr", - "text": [ - ":5: GradioDeprecationWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n", - " gr.inputs.Audio(source=\"microphone\", type=\"filepath\")\n", - ":5: GradioDeprecationWarning: `optional` parameter is deprecated, and it has no effect\n", - " gr.inputs.Audio(source=\"microphone\", type=\"filepath\")\n" - ] - }, - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Setting queue=True in a Colab notebook requires sharing enabled. Setting `share=True` (you can turn this off by setting `share=False` in `launch()` explicitly).\n", - "\n", - "Colab notebook detected. To show errors in colab notebook, set debug=True in launch()\n", - "Running on public URL: https://f833c50c0881778a6b.gradio.live\n", - "\n", - "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" - ] - }, - { - "output_type": "display_data", - "data": { - "text/plain": [ - "" - ], - "text/html": [ - "" - ] - }, - "metadata": {} - }, - { - "output_type": "execute_result", - "data": { - "text/plain": [] - }, - "metadata": {}, - "execution_count": 30 - } - ] - } - ], - "metadata": { - "accelerator": "GPU", - "colab": { - "provenance": [], - "include_colab_link": true - }, - "gpuClass": "standard", - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "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.9.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} \ No newline at end of file

AltStyle によって変換されたページ (->オリジナル) /