Spaces:
Paused
Paused
File size: 813 Bytes
988ce90 57e16da 988ce90 39b5447 57e16da 988ce90 57e16da 988ce90 57e16da |
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 |
import { getInference } from "$lib/agents/getInference";
import type {
AutomaticSpeechRecognitionArgs,
AutomaticSpeechRecognitionOutput,
} from "@huggingface/inference";
import type { Tool } from "$lib/types";
export const speechToTextTool: Tool<
AutomaticSpeechRecognitionArgs["data"],
AutomaticSpeechRecognitionOutput["text"]
> = {
name: "speechToText",
description: "Caption an audio file and returns its text content.",
examples: [
{
prompt: "Transcribe the sound file",
command: "speechToText(audio)",
},
],
call: async (data) => {
return (
await getInference().automaticSpeechRecognition(
{
data: await data,
model: "facebook/wav2vec2-large-960h-lv60-self",
},
{ wait_for_model: true }
)
).text;
},
};
|