Speech to Text (Whisper) to Review (ChatGPT)

Hi Open AI,

I’ve just written a Python script to do the following when run from the terminal on Linux:

  • Records audio from the default mic to a temp file
    • Press ENTER when you have finished recording
  • Converts the wave file to mp3 format
  • Sends the mp3 file to OpenAI for speech-to-text conversion (Whisper)
  • Places the transcribed text on the clipboard
  • Asks if you would like to submit it to ChatGPT
  • If yes, ChatGPT will look for errors and rewrite it
  • Places the updated text on the clipboard

The prompt for ChatGPT at the end of the script is formatted like this:

response = openai.ChatCompletion.create(
        {"role": "system", "content": "You are an expert assistant that reviews text looking for any errors and fixing them."},
        {"role": "user", "content": f"Rewrite the below text. Do not change the meaning of the text. Do not reply to this prompt with anything except the updated text: '{transcript.text}'"}

It works fantastically. This should be built into the web app if possible for paying customers.

I have got a shell script warper for OpenAI chatgpt.sh (gitlab [.] com [/] fenixdragao [/] shellchatgpt), and it does the same steps as your wrapper.

Next, when text-to-voice is available from OpenAI API endpoints, it will be a matter of a few lines of code to play the response as audio, I hope!