-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
44 lines (38 loc) · 1.18 KB
/
index.tsx
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
// import { DecodingOptionsBuilder } from "whisper-turbo";
// import {
// Task,
// initialize,
// SessionManager,
// AvailableModels,
// } from "whisper-turbo";
// import { processAudio } from "./loadAudio";
// function float32ToUint8(float32Array: Float32Array): Uint8Array {
// return new Uint8Array(float32Array.buffer); // Reinterpret buffer as Uint8Array
// }
// async function main() {
// await initialize();
// const session = await new SessionManager().loadModel(
// AvailableModels.WHISPER_TINY,
// () => {
// console.log("Model loaded successfully🤮");
// },
// (p: number) => {
// console.log(`Loading: {$p}%`);
// }
// );
// // Step 3: Configure decoding options
// const options = new DecodingOptionsBuilder()
// .setTask(Task.Transcribe) // Options: Transcribe or Translate
// .build();
// if (session.isErr) {
// console.error("Error loading model:", session.error);
// return;
// }
// // Step 4: Run transcription
// const audioData = await processAudio("path/to/audio.mp3");
// const result = await session.value.transcribe(
// float32ToUint8(audioData),
// false,
// options
// );
// }