andito HF Staff commited on
Commit
bebb6f7
·
1 Parent(s): 55e07d1

fixing session mismatch

Browse files
assets/{index-D5EoIKls.js → index-Dm6Arb8N.js} RENAMED
The diff for this file is too large to render. See raw diff
 
index.html CHANGED
@@ -6,7 +6,7 @@
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
  <meta name="description" content="Real-time speech recognition with Parakeet STT and WebGPU acceleration. Progressive transcription demo." />
8
  <title>Parakeet STT Progressive Transcription | WebGPU Demo</title>
9
- <script type="module" crossorigin src="/assets/index-D5EoIKls.js"></script>
10
  <link rel="stylesheet" crossorigin href="/assets/index-74p16zJW.css">
11
  </head>
12
  <body>
 
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
  <meta name="description" content="Real-time speech recognition with Parakeet STT and WebGPU acceleration. Progressive transcription demo." />
8
  <title>Parakeet STT Progressive Transcription | WebGPU Demo</title>
9
+ <script type="module" crossorigin src="/assets/index-Dm6Arb8N.js"></script>
10
  <link rel="stylesheet" crossorigin href="/assets/index-74p16zJW.css">
11
  </head>
12
  <body>
source/dist/assets/{index-D5EoIKls.js → index-Dm6Arb8N.js} RENAMED
The diff for this file is too large to render. See raw diff
 
source/dist/index.html CHANGED
@@ -6,7 +6,7 @@
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
  <meta name="description" content="Real-time speech recognition with Parakeet STT and WebGPU acceleration. Progressive transcription demo." />
8
  <title>Parakeet STT Progressive Transcription | WebGPU Demo</title>
9
- <script type="module" crossorigin src="/assets/index-D5EoIKls.js"></script>
10
  <link rel="stylesheet" crossorigin href="/assets/index-74p16zJW.css">
11
  </head>
12
  <body>
 
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
  <meta name="description" content="Real-time speech recognition with Parakeet STT and WebGPU acceleration. Progressive transcription demo." />
8
  <title>Parakeet STT Progressive Transcription | WebGPU Demo</title>
9
+ <script type="module" crossorigin src="/assets/index-Dm6Arb8N.js"></script>
10
  <link rel="stylesheet" crossorigin href="/assets/index-74p16zJW.css">
11
  </head>
12
  <body>
source/src/App.jsx CHANGED
@@ -395,12 +395,18 @@ function App() {
395
  const stopRecording = async () => {
396
  if (!isRecording) return;
397
 
398
- // Stop progressive updates
399
  if (progressiveIntervalRef.current) {
400
  clearInterval(progressiveIntervalRef.current);
401
  progressiveIntervalRef.current = null;
402
  }
403
 
 
 
 
 
 
 
404
  // Stop recorder
405
  if (recorderRef.current) {
406
  try {
@@ -409,16 +415,22 @@ function App() {
409
  // Final transcription
410
  const audioBuffer = audioProcessorRef.current.getBuffer();
411
  if (audioBuffer.length > 0 && streamingHandlerRef.current) {
412
- const finalText = await streamingHandlerRef.current.finalize(audioBuffer);
413
- setFixedText(finalText);
414
- setActiveText('');
 
 
 
 
 
 
 
415
  }
416
  } catch (error) {
417
  console.error('Error stopping recording:', error);
418
  }
419
  }
420
 
421
- setIsRecording(false);
422
  setWindowState(null);
423
  };
424
 
 
395
  const stopRecording = async () => {
396
  if (!isRecording) return;
397
 
398
+ // Stop progressive updates first
399
  if (progressiveIntervalRef.current) {
400
  clearInterval(progressiveIntervalRef.current);
401
  progressiveIntervalRef.current = null;
402
  }
403
 
404
+ // Set recording to false immediately to stop the interval loop
405
+ setIsRecording(false);
406
+
407
+ // Wait a bit for any in-flight transcription to complete
408
+ await new Promise(resolve => setTimeout(resolve, 100));
409
+
410
  // Stop recorder
411
  if (recorderRef.current) {
412
  try {
 
415
  // Final transcription
416
  const audioBuffer = audioProcessorRef.current.getBuffer();
417
  if (audioBuffer.length > 0 && streamingHandlerRef.current) {
418
+ try {
419
+ const finalText = await streamingHandlerRef.current.finalize(audioBuffer);
420
+ setFixedText(finalText);
421
+ setActiveText('');
422
+ } catch (error) {
423
+ // Ignore ONNX session errors during cleanup
424
+ if (!error.message.includes('Session')) {
425
+ console.error('Error in final transcription:', error);
426
+ }
427
+ }
428
  }
429
  } catch (error) {
430
  console.error('Error stopping recording:', error);
431
  }
432
  }
433
 
 
434
  setWindowState(null);
435
  };
436