├── db.sqlite3
├── SpeechServer
├── __init__.py
├── wsgi.py
├── urls.py
└── settings.py
├── speech_server_main
├── __init__.py
├── config
│ ├── __init__.py
│ ├── config.json
│ └── config.py
├── deepspeech
│ ├── __init__.py
│ └── deepspeech.py
├── migrations
│ └── __init__.py
├── models.py
├── admin.py
├── tests.py
├── urls.py
├── static
│ ├── css
│ │ ├── theme.css
│ │ └── main.css
│ └── speech_server_main
│ │ ├── wav encoder license
│ │ └── LICENSE.txt
│ │ ├── audioRecorderWorker.js
│ │ ├── audioRecorder.js
│ │ ├── WavAudioEncoder.js
│ │ ├── script.js
│ │ └── resampler.js
├── routing.py
├── logging.py
├── views.py
├── consumers.py
├── apps.py
└── templates
│ └── speech_server_main
│ ├── index.html
│ └── base.html
├── requirements.txt
├── .project
├── manage.py
├── .pydevproject
├── LICENSE
├── .gitignore
└── README.md
/db.sqlite3:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/SpeechServer/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/speech_server_main/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/speech_server_main/config/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/speech_server_main/deepspeech/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/speech_server_main/migrations/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/speech_server_main/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 |
4 | # Create your models here.
5 |
--------------------------------------------------------------------------------
/speech_server_main/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 |
4 | # Register your models here.
5 |
--------------------------------------------------------------------------------
/speech_server_main/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 |
4 | # Create your tests here.
5 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | scipy>=1.1.0
2 | appdirs>=1.4.3
3 | Django==2.1.2
4 | django-cors-headers==2.1.0
5 | django-sslserver==0.20
6 | django-bootstrap3>=9.1.0
7 | django-filter>=1.0.2
8 | djangorestframework>=3.6.2
9 | channels==1.1.8
10 | deepspeech==0.4.0
11 |
--------------------------------------------------------------------------------
/speech_server_main/urls.py:
--------------------------------------------------------------------------------
1 | '''
2 | Created on 01-Jan-2018
3 |
4 | @author: ashwani
5 | '''
6 | from django.urls.conf import path
7 | from . import views
8 |
9 | app_name = 'swp'
10 | urlpatterns = [
11 | path('', views.index, name='index'),
12 | path('handleaudio/', views.handle_audio, name='handleaudio')
13 | ]
--------------------------------------------------------------------------------
/speech_server_main/static/css/theme.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 70px;
3 | padding-bottom: 30px;
4 | }
5 |
6 | .theme-dropdown .dropdown-menu {
7 | position: static;
8 | display: block;
9 | margin-bottom: 20px;
10 | }
11 |
12 | .theme-showcase > p > .btn {
13 | margin: 5px 0;
14 | }
15 |
16 | .theme-showcase .navbar .container {
17 | width: auto;
18 | }
19 |
--------------------------------------------------------------------------------
/speech_server_main/routing.py:
--------------------------------------------------------------------------------
1 | '''
2 | Channels routing configuration.
3 | '''
4 |
5 | from channels.routing import route
6 | from speech_server_main.consumers import ws_connect, ws_message, ws_disconnect
7 | channel_routing = [
8 | route("websocket.connect", ws_connect),
9 | route("websocket.receive", ws_message),
10 | route("websocket.disconnect", ws_disconnect),
11 | ]
12 |
--------------------------------------------------------------------------------
/speech_server_main/config/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "deepspeech": {
3 | "model" :"/media/ashwanip/New Volume/DeepSpeech/models/output_graph.pb",
4 | "lm": "/media/ashwanip/New Volume/DeepSpeech/models/lm.binary",
5 | "trie": "/media/ashwanip/New Volume/DeepSpeech/models/trie",
6 | "audiofiledir": "/media/ashwanip/New Volume/DeepSpeech/audio/",
7 | "audiofilelength": "10",
8 | "debug": "1"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/speech_server_main/static/css/main.css:
--------------------------------------------------------------------------------
1 | .table-nonfluid {
2 | width: auto !important;
3 | }
4 |
5 | .table-nonfluid>thead>tr>th {
6 | width: 220px;
7 | }
8 |
9 | #error-panel, #progress-panel {
10 | display: none;
11 | }
12 |
13 | .progress.active .progress-bar {
14 | -webkit-transition: none !important;
15 | transition: none !important;
16 | }
17 |
18 | .result_container, .form-main {
19 | margin-top: 10px;
20 | }
21 |
--------------------------------------------------------------------------------
/SpeechServer/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for SpeechServer project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "SpeechServer.settings")
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | SpeechServer
4 |
5 |
6 |
7 |
8 |
9 | org.python.pydev.PyDevBuilder
10 |
11 |
12 |
13 |
14 |
15 | org.python.pydev.pythonNature
16 | org.python.pydev.django.djangoNature
17 |
18 |
19 |
--------------------------------------------------------------------------------
/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os
3 | import sys
4 |
5 | if __name__ == "__main__":
6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "SpeechServer.settings")
7 | try:
8 | from django.core.management import execute_from_command_line
9 | except ImportError as exc:
10 | raise ImportError(
11 | "Couldn't import Django. Are you sure it's installed and "
12 | "available on your PYTHONPATH environment variable? Did you "
13 | "forget to activate a virtual environment?"
14 | ) from exc
15 | execute_from_command_line(sys.argv)
16 |
--------------------------------------------------------------------------------
/.pydevproject:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DJANGO_MANAGE_LOCATION
5 | manage.py
6 |
7 |
8 | /${PROJECT_DIR_NAME}
9 |
10 | python interpreter
11 | Default
12 |
13 |
--------------------------------------------------------------------------------
/speech_server_main/logging.py:
--------------------------------------------------------------------------------
1 | import os
2 | from os import path
3 | import logging
4 | from speech_server_main.config import config
5 |
6 | if not path.exists("./logs"):
7 | os.mkdir("./logs")
8 |
9 | logging.basicConfig(filename="./logs/deepspeech_server.log", format='%(levelname)s %(asctime)s %(message)s')
10 | def log(message, log_level="warning"):
11 |
12 | set_debug = config.ConfigDeepSpeech().get_config("debug")
13 | if set_debug == "1":
14 | logging.getLogger(None).setLevel(logging.DEBUG)
15 | if log_level == "debug":
16 | logging.debug(message)
17 | elif log_level == "info":
18 | logging.info(message)
19 | elif log_level == "error":
20 | logging.error(message)
21 | else:
22 | logging.warning(message)
--------------------------------------------------------------------------------
/SpeechServer/urls.py:
--------------------------------------------------------------------------------
1 | """SpeechServer URL Configuration
2 |
3 | The `urlpatterns` list routes URLs to views. For more information please see:
4 | https://docs.djangoproject.com/en/2.0/topics/http/urls/
5 | Examples:
6 | Function views
7 | 1. Add an import: from my_app import views
8 | 2. Add a URL to urlpatterns: path('', views.home, name='home')
9 | Class-based views
10 | 1. Add an import: from other_app.views import Home
11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12 | Including another URLconf
13 | 1. Import the include() function: from django.urls import include, path
14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15 | """
16 | from django.conf.urls import include, url
17 | from django.contrib import admin
18 | from django.views.generic import RedirectView
19 |
20 | urlpatterns = [
21 | url(r'^$', RedirectView.as_view(url='/dsserver')),
22 | url(r'^admin/', admin.site.urls),
23 | url(r'^dsserver/', include('speech_server_main.urls')),
24 | ]
25 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Ashwani Pandey
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/speech_server_main/views.py:
--------------------------------------------------------------------------------
1 | from django.shortcuts import render
2 | from django.views.decorators.csrf import ensure_csrf_cookie, csrf_exempt
3 | from django.http.response import HttpResponse
4 | from datetime import datetime
5 | from .deepspeech import deepspeech as ds
6 | from speech_server_main.config import config
7 | from speech_server_main import logging
8 |
9 | conf = config.ConfigDeepSpeech()
10 |
11 | @ensure_csrf_cookie
12 | def index(request):
13 | return render(request, 'speech_server_main/index.html')
14 |
15 | @csrf_exempt
16 | def handle_audio(request):
17 | try:
18 | data=request.body
19 | audiofiledir = conf.get_config('audiofiledir')
20 | file_name = audiofiledir + 'http_generated_' + datetime.now().strftime('%y-%m-%d_%H%M%S')
21 | logging.log("file name: {0}".format(file_name), "debug")
22 | with open(file_name, 'wb') as f:
23 | f.write(data)
24 |
25 | msg = ds.stt(file_name)
26 | except Exception as err:
27 | logging.log("exception occurred in handle_audio: {0}".format(err), "error")
28 | msg = "failed"
29 | return HttpResponse(msg)
30 |
--------------------------------------------------------------------------------
/speech_server_main/consumers.py:
--------------------------------------------------------------------------------
1 | '''
2 | Channel consumers
3 | '''
4 |
5 | from datetime import datetime
6 | from speech_server_main.config import config
7 | from .deepspeech import deepspeech as ds
8 | import os, re
9 |
10 | conf = config.ConfigDeepSpeech()
11 |
12 | audiofiledir = conf.get_config('audiofiledir')
13 | def ws_connect(message):
14 | # Accept the incoming connection
15 | message.reply_channel.send({"accept": True})
16 | print('websocket connected')
17 |
18 | def ws_message(message):
19 | print('ws message received')
20 | file_name = audiofiledir + 'ws_generated' + datetime.now().strftime('%y-%m-%d_%H%M%S')
21 | with open(file_name, 'wb') as fp:
22 | fp.write(message.content['bytes'])
23 | fp.flush()
24 | msg = ds.stt(file_name, True)
25 | message.reply_channel.send({'text':msg})
26 |
27 | def ws_disconnect(message):
28 | print('ws disconnected')
29 | delete_files_in_dir('^ws_generated', audiofiledir)
30 |
31 | def delete_files_in_dir(pattern, dir):
32 | print('inside delete module')
33 | for file in os.listdir(dir):
34 | if re.search(pattern, file):
35 | os.remove(os.path.join(dir, file))
36 |
--------------------------------------------------------------------------------
/speech_server_main/static/speech_server_main/wav encoder license/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Yuji Miyane
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/speech_server_main/config/config.py:
--------------------------------------------------------------------------------
1 | import os
2 | import json
3 | from functools import lru_cache
4 |
5 | class ConfigDeepSpeech:
6 |
7 | @lru_cache(maxsize=32)
8 | def get_config(self, key):
9 | print('inside module')
10 | module_dir = os.path.dirname(__file__) # get current directory
11 | file_path = os.path.join(module_dir, 'config.json')
12 |
13 | with open(file_path, 'r') as f:
14 | config = json.load(f)
15 |
16 | ds_config = config['deepspeech']
17 | model = ds_config['model']
18 | lm = ds_config['lm']
19 | trie = ds_config['trie']
20 | audiofiledir = ds_config['audiofiledir']
21 | audiofilelength = ds_config['audiofilelength']
22 | debug = ds_config['debug']
23 | if key == 'model':
24 | return model
25 | elif key == 'lm':
26 | return lm
27 | elif key == 'trie':
28 | return trie
29 | elif key == 'audiofiledir':
30 | return audiofiledir
31 | elif key == 'audiofilelength':
32 | return audiofilelength
33 | elif key == 'debug':
34 | return debug
35 | else:
36 | raise Exception('Invalid key value.')
37 |
--------------------------------------------------------------------------------
/speech_server_main/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 | from deepspeech import Model
3 | from speech_server_main.config import config
4 |
5 | # These constants control the beam search decoder
6 |
7 | # Beam width used in the CTC decoder when building candidate transcriptions
8 | BEAM_WIDTH = 500
9 |
10 | # The alpha hyperparameter of the CTC decoder. Language Model weight
11 | LM_ALPHA = 0.75
12 |
13 | # The beta hyperparameter of the CTC decoder. Word insertion bonus.
14 | LM_BETA = 1.85
15 |
16 | # These constants are tied to the shape of the graph used (changing them changes
17 | # the geometry of the first layer), so make sure you use the same constants that
18 | # were used during training
19 |
20 | # Number of MFCC features to use
21 | # N_FEATURES = 26
22 |
23 | # Size of the context window used for producing timesteps in the input vector
24 | # N_CONTEXT = 9
25 |
26 |
27 | class SpeechServerMain(AppConfig):
28 | name = 'speech_server_main'
29 | conf = config.ConfigDeepSpeech()
30 | model = conf.get_config('model')
31 | lm = conf.get_config('lm')
32 | trie = conf.get_config('trie')
33 |
34 | ds = Model(model, BEAM_WIDTH)
35 | if lm and trie:
36 | ds.enableDecoderWithLM(lm, trie, LM_ALPHA, LM_BETA)
37 |
38 | def ready(self):
39 | print("Deepspeech Server Initialization")
40 |
--------------------------------------------------------------------------------
/speech_server_main/static/speech_server_main/audioRecorderWorker.js:
--------------------------------------------------------------------------------
1 | importScripts('/static/speech_server_main/resampler.js');
2 | importScripts('/static/speech_server_main/WavAudioEncoder.js');
3 |
4 | var recLength = 0;
5 | var recBuffersL = [];
6 | var bits = 16;
7 | var sampleRate;
8 | var encoder;
9 | var resampler;
10 |
11 | this.onmessage = function(e){
12 | switch(e.data.command){
13 | case 'init':
14 | init(e.data.config);
15 | break;
16 | case 'record':
17 | record(e.data.buffer);
18 | break;
19 | case 'exportWAV':
20 | exportWAV(e.data.type, e.data.doCleanup);
21 | break;
22 | case 'clear':
23 | clear();
24 | break;
25 | }
26 | };
27 |
28 | function init(config){
29 | var contextSampleRate = config.contextSampleRate;
30 | sampleRate = config.desiredSampleRate;
31 | encoder = new WavAudioEncoder(sampleRate, 1);
32 | resampler = new Resampler(contextSampleRate, sampleRate, 1, 4096);
33 | }
34 |
35 | function record(inputBuffer) {
36 | if(typeof resampler !== 'undefined'){
37 | inputBuffer[0] = resampler.resampler(inputBuffer[0]);
38 | }
39 | encoder.encode(inputBuffer);
40 | }
41 |
42 | function exportWAV(type, doCleanup) {
43 | var audioBlob = encoder.finish(type, doCleanup);
44 | this.postMessage(audioBlob);
45 | }
46 |
47 | function clear() {
48 | encoder.cancel();
49 | }
50 |
51 |
--------------------------------------------------------------------------------
/speech_server_main/deepspeech/deepspeech.py:
--------------------------------------------------------------------------------
1 | import scipy.io.wavfile as wav
2 | from speech_server_main.apps import SpeechServerMain
3 | from speech_server_main.config import config
4 | from speech_server_main import logging
5 |
6 | audiolength = float(config.ConfigDeepSpeech().get_config("audiofilelength"))
7 |
8 | def stt(audioPath, from_websocket=False):
9 | try:
10 | logging.log("Inside deepspeech.stt function", "info")
11 | text = ""
12 | fs, audio = wav.read(audioPath)
13 | if fs == 16000:
14 | if from_websocket or check_audio_lenth(len(audio)):
15 | logging.log("Starting transcribing...", "info")
16 | text = SpeechServerMain.ds.stt(audio)
17 | logging.log("Audio transcribed.", "info")
18 | elif not from_websocket:
19 | text = "Audio should be less than " + str(audiolength) + " seconds."
20 | else:
21 | text = "Frame rate of submitted audio should be 16000 kHz."
22 | #print('after inference: %s' % text)
23 | except Exception as err:
24 | logging.log("exception occurred: {0}".format(err), "error")
25 | text = "Some error occurred while transcribing."
26 |
27 | return text
28 |
29 | def check_audio_lenth(len_audio):
30 | len_audio = len_audio / 16000
31 | if len_audio > audiolength:
32 | return False;
33 | else:
34 | return True;
35 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | env/
12 | build/
13 | develop-eggs/
14 | dist/
15 | downloads/
16 | eggs/
17 | .eggs/
18 | lib/
19 | lib64/
20 | parts/
21 | sdist/
22 | var/
23 | *.egg-info/
24 | .installed.cfg
25 | *.egg
26 |
27 | # PyInstaller
28 | # Usually these files are written by a python script from a template
29 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
30 | *.manifest
31 | *.spec
32 |
33 | # Installer logs
34 | pip-log.txt
35 | pip-delete-this-directory.txt
36 |
37 | # Unit test / coverage reports
38 | htmlcov/
39 | .tox/
40 | .coverage
41 | .coverage.*
42 | .cache
43 | nosetests.xml
44 | coverage.xml
45 | *,cover
46 | .hypothesis/
47 |
48 | # Translations
49 | *.mo
50 | *.pot
51 |
52 | # Django stuff:
53 | *.log
54 | local_settings.py
55 |
56 | # Flask stuff:
57 | instance/
58 | .webassets-cache
59 |
60 | # Scrapy stuff:
61 | .scrapy
62 |
63 | # Sphinx documentation
64 | docs/_build/
65 |
66 | # PyBuilder
67 | target/
68 |
69 | # IPython Notebook
70 | .ipynb_checkpoints
71 |
72 | # pyenv
73 | .python-version
74 |
75 | # celery beat schedule file
76 | celerybeat-schedule
77 |
78 | # dotenv
79 | .env
80 |
81 | # virtualenv
82 | venv/
83 | ENV/
84 |
85 | # Spyder project settings
86 | .spyderproject
87 |
88 | # Rope project settings
89 | .ropeproject
90 | .idea
91 |
92 | data/
93 |
--------------------------------------------------------------------------------
/speech_server_main/static/speech_server_main/audioRecorder.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Record audio
3 | */
4 | (function(window){
5 |
6 | function AudioRecorderObject(source) {
7 | var callback;
8 | var recording = false;
9 |
10 | this.context = source.context;
11 | this.node = (this.context.createScriptProcessor ||
12 | this.context.createJavaScriptNode).call(this.context, 4096, 2, 2);
13 | var worker = new Worker('/static/speech_server_main/audioRecorderWorker.js');
14 |
15 | worker.onmessage = function(e){
16 | var blob = e.data;
17 | callback(blob);
18 | };
19 |
20 | worker.postMessage({
21 | command: 'init',
22 | config: {
23 | contextSampleRate: this.context.sampleRate,
24 | desiredSampleRate: 16000,
25 | }
26 | });
27 |
28 | this.record = function(){
29 | recording = true;
30 | };
31 |
32 | this.stop = function(){
33 | recording = false;
34 | };
35 |
36 | this.clear = function(){
37 | worker.postMessage({ command: 'clear' });
38 | };
39 |
40 | this.exportWAV = function(cb, doCleanup){
41 | callback = cb;
42 | if (!callback) throw new Error('Unable to set callback function. Please check if provided.');
43 |
44 | worker.postMessage({
45 | command: 'exportWAV',
46 | type: 'audio/wav',
47 | doCleanup: doCleanup,
48 | });
49 | };
50 |
51 | this.node.onaudioprocess = function(e){
52 | if (!recording) return;
53 |
54 |
55 | worker.postMessage({
56 | command: 'record',
57 | buffer: [
58 | e.inputBuffer.getChannelData(0),
59 | ]
60 | });
61 | };
62 |
63 | source.connect(this.node);
64 | this.node.connect(this.context.destination); //need to check if this is required.
65 |
66 | }
67 |
68 | var audioRecorder = {
69 |
70 | fromSource: function(src){
71 | return new AudioRecorderObject(src);
72 | }
73 | };
74 |
75 | window.audioRecorder = audioRecorder;
76 |
77 | })(window);
--------------------------------------------------------------------------------
/speech_server_main/templates/speech_server_main/index.html:
--------------------------------------------------------------------------------
1 | {% extends "speech_server_main/base.html" %}
2 | {% block content %}
3 |
4 | {# Load the tag library #}
5 | {% load bootstrap3 %}
6 |
Deepspeech Server
7 | This is Mozilla deepspeech server implemented in django.
8 | One can record sound in browser or choose an audio file and submit it to get corresponding text.
9 |
10 |