-
Notifications
You must be signed in to change notification settings - Fork 0
/
deepspeech-stream.html
164 lines (161 loc) · 7.99 KB
/
deepspeech-stream.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!--
Copyright 2021, Johannes Kropf
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/javascript">
RED.nodes.registerType('deepspeech-stream',{
category: 'deepspeech',
color: '#009688',
defaults: {
modelPath: {value:"", required:true},
scorerPath: {value:"", required:true},
showAdvanced: {value:false},
enableBeamwidth: {value:false},
beamWidth: {value:""},
enableAlphaBeta: {value:false},
lmAlpha: {value:""},
lmBeta: {value:""},
disableScorer: {value:false},
finalTimeout: {value:"300", required:true},
inputProp: {value:"payload"},
outputProp: {value:"payload"},
name: {value:""}
},
inputs:1,
outputs:1,
icon: "font-awesome/fa-road",
label: function() {
return this.name||"deepspeech-stream";
},
oneditprepare: function() {
var node = this;
$("#node-input-inputProp").typedInput({
type:"msg",
types:["msg"]
});
$("#node-input-outputProp").typedInput({
type:"msg",
types:["msg"]
});
$("#node-input-showAdvanced").on("change", function(){
if(!$("#node-input-showAdvanced").prop("checked")){
$("#advancedWrapper").hide();
if($("#node-input-disableScorer").prop("checked")) {
$("#node-input-scorerPath").prop("disabled", false);
}
} else {
$("#advancedWrapper").show();
if($("#node-input-disableScorer").prop("checked")) {
$("#node-input-scorerPath").prop("disabled", true);
}
}
});
$("#node-input-enableBeamwidth").on("change", function(){
if($("#node-input-enableBeamwidth").prop("checked")){
$("#node-input-beamWidth").prop("disabled", false);
} else if (!$("#node-input-enableBeamwidth").prop("checked")) {
$("#node-input-beamWidth").prop("disabled", true);
}
});
$("#node-input-enableAlphaBeta").on("change", function(){
if($("#node-input-enableAlphaBeta").prop("checked")){
$("#node-input-lmAlpha").prop("disabled", false);
$("#node-input-lmBeta").prop("disabled", false);
} else if (!$("#node-input-enableAlphaBeta").prop("checked")) {
$("#node-input-lmAlpha").prop("disabled", true);
$("#node-input-lmBeta").prop("disabled", true);
}
});
$("#node-input-disableScorer").on("change", function(){
if($("#node-input-showAdvanced").prop("checked") && $("#node-input-disableScorer").prop("checked")){
$("#node-input-scorerPath").prop("disabled", true);
$("#node-input-enableAlphaBeta").prop("disabled", true);
$("#node-input-lmAlpha").prop("disabled", true);
$("#node-input-lmBeta").prop("disabled", true);
} else if ($("#node-input-showAdvanced").prop("checked") && !$("#node-input-disableScorer").prop("checked")) {
$("#node-input-scorerPath").prop("disabled", false);
$("#node-input-enableAlphaBeta").prop("disabled", false);
if ($("#node-input-enableAlphaBeta").prop("checked")) {
$("#node-input-lmAlpha").prop("disabled", false);
$("#node-input-lmBeta").prop("disabled", false);
}
}
});
}
});
</script>
<script type="text/html" data-template-name="deepspeech-stream">
<h4>Basic Settings</h4>
<div class="form-row">
<label for="node-input-modelPath"><i class="fa fa-file-code-o"></i> Model Path</label>
<input type="text" id="node-input-modelPath" placeholder="Model Path">
</div>
<div class="form-row">
<label for="node-input-scorerPath"><i class="fa fa-file-code-o"></i> Scorer Path</label>
<input type="text" id="node-input-scorerPath" placeholder="Scorer">
</div>
<div class="form-row">
<label for="node-input-finalTimeout"><i class="fa fa-clock-o"></i> timeout (ms)</label>
<input type="text" id="node-input-finalTimeout" placeholder="300">
</div>
<div class="form-row">
<label for="node-input-showAdvanced"><i class="fa fa-cogs"></i> Advanced</label>
<input type="checkbox" id="node-input-showAdvanced" style="display:inline-block; width: auto; vertical-align:baseline;" value="true">
<label for="node-input-showAdvanced" style="width: 70%;">enable advanced options</label>
</div>
<div id="advancedWrapper">
<h4>Advanced Settings</h4>
<div class="form-row">
<label for="node-input-beamWidth"><i class="fa fa-arrows-h"></i> Beam Width</label>
<input type="text" id="node-input-beamWidth" placeholder="enter a Beam Width (int)">
<input type="checkbox" id="node-input-enableBeamwidth" style="display:inline-block; width: auto; vertical-align:baseline;" value="false">
</div>
<div class="form-row">
<label for="node-input-enableAlphaBeta"><i class="fa fa-check"></i> Alpha Beta</label>
<input type="checkbox" id="node-input-enableAlphaBeta" style="display:inline-block; width: auto; vertical-align:baseline;" value="false">
<label for="node-input-enableAlphaBeta" style="width: 70%;">override scorer alpha and beta value</label>
</div>
<div class="form-row">
<label for="node-input-lmAlpha"><i class="fa fa-toggle-up"></i> lm_alpha</label>
<input type="text" id="node-input-lmAlpha" placeholder="enter a lm_alpha value (float)">
</div>
<div class="form-row">
<label for="node-input-lmBeta"><i class="fa fa-toggle-up"></i> lm_beta</label>
<input type="text" id="node-input-lmBeta" placeholder="enter a lm_beta value (float)">
</div>
<div class="form-row">
<label for="node-input-disableScorer"><i class="fa fa-ban"></i> Scorer</label>
<input type="checkbox" id="node-input-disableScorer" style="display:inline-block; width: auto; vertical-align:baseline;" value="false">
<label for="node-input-disableScorer" style="width: 70%;">disable external scorer</label>
</div>
</div>
<h4>Input/Output Settings</h4>
<div class="form-row">
<label for="node-input-inputProp"><i class="fa fa-sign-in"></i> Input Field</label>
<input type="text" id="node-input-inputProp">
</div>
<div class="form-row">
<label for="node-input-outputProp"><i class="fa fa-sign-out"></i> Output Field</label>
<input type="text" id="node-input-outputProp">
</div>
<h4>Other Settings</h4>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/html" data-help-name="deepspeech-stream">
<p>A simple node to decode audio from a raw pcm audio stream to text with deepspeech.
For the documentation
please see the
<a href="https://github.com/johanneskropf/node-red-contrib-deepspeech-stt/blob/main/README.md">
readme</a>.</p>
</script>