Spaces:
Running
Running
Delete index.html
Browse files- index.html +0 -64
index.html
DELETED
@@ -1,64 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html lang="en">
|
3 |
-
<head>
|
4 |
-
<meta charset="UTF-8">
|
5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
-
<title>Voice Activity Detection Demo</title>
|
7 |
-
<script src="https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.min.js"></script>
|
8 |
-
<script src="https://cdn.tailwindcss.com"></script>
|
9 |
-
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
10 |
-
<script>
|
11 |
-
ort.env.wasm.wasmPaths = 'https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/';
|
12 |
-
</script>
|
13 |
-
</head>
|
14 |
-
<body>
|
15 |
-
<main class="flex min-h-screen flex-col items-center justify-between p-24">
|
16 |
-
<div class="text-center">
|
17 |
-
<div id="status" class="text-4xl mb-4">π Not Listening</div>
|
18 |
-
<div id="audioList" class="space-y-4"></div>
|
19 |
-
</div>
|
20 |
-
</main>
|
21 |
-
|
22 |
-
<script type="module">
|
23 |
-
import { SpeechChunks } from './SpeechChunks.ts';
|
24 |
-
|
25 |
-
let speechChunks;
|
26 |
-
|
27 |
-
function updateStatus(isListening) {
|
28 |
-
document.getElementById('status').textContent = isListening ? "ποΈ Listening..." : "π Not Listening";
|
29 |
-
}
|
30 |
-
|
31 |
-
function addAudioToList(blob) {
|
32 |
-
const audioList = document.getElementById('audioList');
|
33 |
-
const audio = document.createElement('audio');
|
34 |
-
audio.controls = true;
|
35 |
-
audio.src = URL.createObjectURL(blob);
|
36 |
-
audio.onended = () => URL.revokeObjectURL(audio.src);
|
37 |
-
audioList.appendChild(audio);
|
38 |
-
}
|
39 |
-
|
40 |
-
async function initializeSpeechChunks() {
|
41 |
-
try {
|
42 |
-
speechChunks = new SpeechChunks(
|
43 |
-
() => {
|
44 |
-
console.log("speech start");
|
45 |
-
updateStatus(true);
|
46 |
-
},
|
47 |
-
(blob) => {
|
48 |
-
console.log("speech end");
|
49 |
-
updateStatus(false);
|
50 |
-
addAudioToList(blob);
|
51 |
-
}
|
52 |
-
);
|
53 |
-
await speechChunks.start();
|
54 |
-
} catch (error) {
|
55 |
-
console.error("Error initializing SpeechChunks:", error);
|
56 |
-
updateStatus(false);
|
57 |
-
document.getElementById('status').textContent = "Error: " + error.message;
|
58 |
-
}
|
59 |
-
}
|
60 |
-
|
61 |
-
initializeSpeechChunks();
|
62 |
-
</script>
|
63 |
-
</body>
|
64 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|