MCPcopy Create free account
hub / github.com/diffusionstudio/vits-web / main

Function main

example/worker.ts:3–14  ·  view source on GitHub ↗
(event: MessageEvent<tts.InferenceConfg & { type: 'init' }>)

Source from the content-addressed store, hash-verified

1import * as tts from '../src/index';
2
3async function main(event: MessageEvent<tts.InferenceConfg & { type: 'init' }>) {
4 if (event.data?.type != 'init') return;
5
6 const start = performance.now();
7 const blob = await tts.predict({
8 text: event.data.text,
9 voiceId: event.data.voiceId,
10 });
11 console.log('Time taken:', performance.now() - start + ' ms');
12
13 self.postMessage({ type: 'result', audio: blob })
14}
15
16self.addEventListener('message', main);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected