@omnimedia/omnitool
Version:
open source video processing tools
26 lines (22 loc) • 668 B
text/typescript
import {Comrade} from "@e280/comrade"
import {ProgressItem} from "../parts/types.js"
import {SpeechRecognizerHostEvents, WhisperSchematic} from "./schematic.js"
export const setupWhisperHost = (events: SpeechRecognizerHostEvents) => (
Comrade.host<WhisperSchematic>(_shell => ({
async updateModelLoadProgress(item) {
events.onModelLoadProgress.pub(item)
},
async deliverTranscriptionChunk(chunk) {
events.onTranscriptionChunk.pub({
text: chunk.text,
timestamp: chunk.timestamp
})
},
async updateTps(value) {
events.onTpsUpdate.pub(value)
},
async updateTranscribeProgress(value) {
events.onTranscribeProgress(value)
}
}))
)