whisper
#160
Replies: 1 comment 2 replies
-
I implemented whisper on this template. const sentToChatGPT = async (audioBlob: Blob) => {
const formData = new FormData();
formData.append('file', audioBlob, 'audio.webm');
formData.append('model', 'whisper-1');
formData.append('token', previewToken);
formData.append('language', inputLanguage);
try {
const res = await fetch('/api/whisper', {
method: 'POST',
body: formData,
});
const { text, error } = await res.json();
if (text) {
const args: Message = { id: id as string, content: text, role: 'user' };
await append(args);
if (pathname === '/') {
router.push(`/chat/${id}`);
}
} else {
console.error('Error from whisper response', error);
}
} catch (error: any) {
console.error('In voice-recorder component', error.message);
}
}; I call this function on onRecordingComplete prop <AudioRecorder
recorderControls={recorderControls}
onRecordingComplete={(audioBlob: Blob) => sentToChatGPT(audioBlob)}
/>
``` |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
is it possible to do the use case microphone -> whisper -> text via streaming?
meaning can i record voiced via microphone and get the real time stream of the text back?
thanks!
Beta Was this translation helpful? Give feedback.
All reactions