{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%reload_ext autoreload\n", "%autoreload 2\n", "%matplotlib inline\n", "import os\n", "os.environ[\"CUDA_DEVICE_ORDER\"]=\"PCI_BUS_ID\";\n", "os.environ[\"CUDA_VISIBLE_DEVICES\"]=\"0\" " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--2021-11-05 14:37:44-- https://github.com/amaiya/ktrain/blob/develop/ktrain/tests/text_data/sample.wav?raw=true\n", "Resolving github.com (github.com)... 140.82.112.3\n", "Connecting to github.com (github.com)|140.82.112.3|:443... connected.\n", "HTTP request sent, awaiting response... 302 Found\n", "Location: https://github.com/amaiya/ktrain/raw/develop/ktrain/tests/text_data/sample.wav [following]\n", "--2021-11-05 14:37:44-- https://github.com/amaiya/ktrain/raw/develop/ktrain/tests/text_data/sample.wav\n", "Reusing existing connection to github.com:443.\n", "HTTP request sent, awaiting response... 302 Found\n", "Location: https://raw.githubusercontent.com/amaiya/ktrain/develop/ktrain/tests/text_data/sample.wav [following]\n", "--2021-11-05 14:37:44-- https://raw.githubusercontent.com/amaiya/ktrain/develop/ktrain/tests/text_data/sample.wav\n", "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.109.133, 185.199.111.133, 185.199.110.133, ...\n", "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.109.133|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: 23948 (23K) [audio/wav]\n", "Saving to: ‘/tmp/sample.wav’\n", "\n", "/tmp/sample.wav 100%[===================>] 23.39K --.-KB/s in 0s \n", "\n", "2021-11-05 14:37:45 (59.0 MB/s) - ‘/tmp/sample.wav’ saved [23948/23948]\n", "\n" ] } ], "source": [ "# get sample wav file\n", "!wget -O /tmp/sample.wav https://github.com/amaiya/ktrain/blob/develop/ktrain/tests/text_data/sample.wav?raw=true" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "from ktrain.text.speech import Transcriber" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "transcriber = Transcriber()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['Add the sum to the product of these three']" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "afiles = ['/tmp/sample.wav']\n", "result = transcriber.transcribe(afiles)\n", "result" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.6.9" } }, "nbformat": 4, "nbformat_minor": 2 }