File tree Expand file tree Collapse file tree 3 files changed +10
-33
lines changed
widgets/src/lib/InferenceWidget/widgets
AudioClassificationWidget
AutomaticSpeechRecognitionWidget Expand file tree Collapse file tree 3 files changed +10
-33
lines changed Original file line number Diff line number Diff line change 2828 let output: Array < { label: string; score: number }> = [];
2929 let outputJson: string;
3030 let selectedSampleUrl = " " ;
31- let shouldAudioAutoplay = true ;
3231
3332 function onRecordStart () {
3433 file = null ;
4241 }
4342
4443 function onSelectFile (updatedFile : Blob | File ) {
45- shouldAudioAutoplay = false ;
4644 isRecording = false ;
4745 selectedSampleUrl = " " ;
4846
125123 }
126124
127125 function applyInputSample (sample : Record < string , any > ) {
128- shouldAudioAutoplay = false ;
126+ file = null ;
129127 filename = sample .example_title ;
130128 fileUrl = sample .src ;
131129 selectedSampleUrl = sample .src ;
132130 getOutput ();
133131 }
134132
135133 function previewInputSample (sample : Record < string , any > ) {
136- shouldAudioAutoplay = true ;
137134 filename = sample .example_title ;
138135 fileUrl = sample .src ;
139136 output = [];
170167 />
171168 </div >
172169 {#if fileUrl }
173- <WidgetAudioTrack
174- classNames =" mt-3"
175- autoplay ={shouldAudioAutoplay }
176- label ={filename }
177- src ={fileUrl }
178- />
170+ <WidgetAudioTrack classNames ="mt-3" label ={filename } src ={fileUrl } />
179171 {/if }
180172 <WidgetSubmitBtn
181173 classNames =" mt-2"
Original file line number Diff line number Diff line change 2727 let output: AudioItem[] = [];
2828 let outputJson: string;
2929 let selectedSampleUrl = " " ;
30- let shouldAudioAutoplay = true ;
3130
3231 interface AudioItem {
3332 blob: string;
4847 }
4948
5049 function onSelectFile (updatedFile : Blob | File ) {
51- shouldAudioAutoplay = false ;
5250 isRecording = false ;
5351 selectedSampleUrl = " " ;
5452 if (updatedFile .size !== 0 ) {
131129 }
132130
133131 function applyInputSample (sample : Record < string , any > ) {
134- shouldAudioAutoplay = false ;
132+ file = null ;
135133 filename = sample .example_title ;
136134 fileUrl = sample .src ;
137135 selectedSampleUrl = sample .src ;
138136 getOutput ();
139137 }
140138
141139 function previewInputSample (sample : Record < string , any > ) {
142- shouldAudioAutoplay = true ;
143140 filename = sample .example_title ;
144141 fileUrl = sample .src ;
145142 output = [];
176173 />
177174 </div >
178175 {#if fileUrl }
179- <WidgetAudioTrack
180- classNames =" mt-3"
181- autoplay ={shouldAudioAutoplay }
182- label ={filename }
183- src ={fileUrl }
184- />
176+ <WidgetAudioTrack classNames ="mt-3" label ={filename } src ={fileUrl } />
185177 {/if }
186178 <WidgetSubmitBtn
187179 classNames =" mt-2"
195187 </svelte:fragment >
196188 <svelte:fragment slot =" bottom" >
197189 {#each output as item }
198- <div >{item .label }</div >
199- :
200- <WidgetAudioTrack classNames ="mt-4" src ={item .src } />
190+ <div class =" flex items-center mt-2" >
191+ <span class ="mr-2" >{item .label }:</span >
192+ <WidgetAudioTrack classNames ="" src ={item .src } />
193+ </div >
201194 {/each }
202195 </svelte:fragment >
203196</WidgetWrapper >
Original file line number Diff line number Diff line change 2828 let output = " " ;
2929 let outputJson: string;
3030 let selectedSampleUrl = " " ;
31- let shouldAudioAutoplay = true ;
3231
3332 function onRecordStart () {
3433 file = null ;
4241 }
4342
4443 function onSelectFile (updatedFile : Blob | File ) {
45- shouldAudioAutoplay = false ;
4644 isRecording = false ;
4745 selectedSampleUrl = " " ;
4846
114112 }
115113
116114 function applyInputSample (sample : Record < string , any > ) {
117- shouldAudioAutoplay = false ;
115+ file = null ;
118116 filename = sample .example_title ;
119117 fileUrl = sample .src ;
120118 selectedSampleUrl = sample .src ;
121119 getOutput ();
122120 }
123121
124122 function previewInputSample (sample : Record < string , any > ) {
125- shouldAudioAutoplay = true ;
126123 filename = sample .example_title ;
127124 fileUrl = sample .src ;
128125 output = " " ;
159156 />
160157 </div >
161158 {#if fileUrl }
162- <WidgetAudioTrack
163- classNames =" mt-3"
164- autoplay ={shouldAudioAutoplay }
165- label ={filename }
166- src ={fileUrl }
167- />
159+ <WidgetAudioTrack classNames ="mt-3" label ={filename } src ={fileUrl } />
168160 {/if }
169161 <WidgetSubmitBtn
170162 classNames =" mt-2"
You can’t perform that action at this time.
0 commit comments