#React Native Whisper Speech-to-text

1 messages · Page 1 of 1 (latest)

dull cobalt
#

Hey, I need little help figuring out a way to use whisper in a react native fetch call. I cannot simply pass in the URI string but I'm not sure exactly what type the required UploadFile object is. I'm currently building the React Native application with Expo. I've tried using react-native-fs and I also tried fetching the data as blob object. Just wondering if anyone has managed to successfully use whisper in some kind of js application.

    const formData = new FormData();

    formData.append("file", uri);
    formData.append("model", "whisper-1");
    response = await fetch(https://api.openai.com/v1/audio/transcriptions, {
      method: "POST",
      headers: {...}
      body: formData,
    });
    console.log("response ", response);
    const transcription = await response.json();