Thursday, September 28, 2023

How To Convert ChatGPT Into An Advanced Voice Assistant

By Ashwini Kumar Sinha

- Advertisement -

ChatGPT-3 needs no introduction. You ask it any question and it replies in a flash. But the answer comes in the form of text. What if you could talk with it, just like you do with any voice assistant like Siri?

It’s no secret that ChatGPT has revolutionised the world of AI. Unlike other AI bots, it is able to understand the context of a conversation and respond, and it makes you feel like you are chatting with a human and not a machine.

POC Video In English:

POC Video In Hindi:

- Advertisement -

But as it is still a kind of chatbot, you need to type a question and you get the answer in the form of text. That’s not as exciting as talking to a bot.

This thought gave me the idea of programming ChatGPT so that it could be used as a voice assistant called VoiceGPT. I began by using natural language processing (NLP) to recognise the voice, and then transferring the recognised voice to the ChatGPT engine as a query using the API. After getting an intelligent reply from ChatGPT, I again used NLP to convert it into a human voice.

VoiceGPT working principle
Fig. 1: VoiceGPT working principle

I needed a good NLP tool for this and OpenAI itself provides one, that is, Whisper. But due to limited time and space, I ended up using Google Natural Language API.

A step-by-step guide to making VoiceGPT

We need to begin by combining the NLP for the ttX service with ChatGPT. For this we need a machine to run the open API, transfer the query gathered from NLP, and reprocess the answer given by ChatGPT into a human voice using NLP.

You can use any laptop, but I chose the Raspberry Pi to run all this. For capturing the voice for recognition, I attached the voice bonnet; a USB microphone can also be used with Raspberry Pi. However, if you are using a laptop to run the VoiceGPT code, there is no need for a USB microphone; you can use the laptop’s inbuilt microphone.

We now need to create an account and log into ChatGPT (see Fig. 2).

ChatGPT login page
Fig. 2: ChatGPT login page

Next, we need to get the API key for doing research and experimenting with the ChatGPT code, as shown in Fig. 3.

Getting the OpenAI API menu
Fig. 3: Getting the OpenAI API menu
ChatGPT API keys
Fig. 4: ChatGPT API keys

You can create the API key using the right-corner option for API in your OpenAI account (Fig. 4).

After generating the OpenAI API key, copy it and save it. We need it later in our code for developing VoiceGPT.

Now we need to install the open AI on the system where we are going to run the VoiceGPT. Here you can use a computer with any Linux version installed. I used Raspberry Pi for it.

Next, open the terminal and install the open AI and other Python modules that help us in natural language processing. Here you can use Whisper from OpenAI or any other NLP module. I used Google NLP and combined it with ChatGPT.

Fig. 5: Cloning OpenAi ChatGPT code
Cloning OpenAi ChatGPT code

You can install these modules using the following command. After that, you can either create your open custom talking content in OpenAI or use simple chatting in the playground. Here, you can also set the temperature, frequency, and other parameters for your VoiceGPT assistant.

sudo pip3 install openai
sudo pip3 install SpeechRecognition
sudo pip3 install gTTS

WHERE IS THE REST OF THIS ARTICLE'S CONTENT?

This is PREMIUM content, which means that only
REGISTERED users of our website can read it, by logging in.

If you ARE a registered user, CLICK HERE to login.
Else, CLICK HERE to register for FREE!

1 COMMENT

  1. “”How To Convert ChatGPT Into An Advanced Voice Assistant””
    This very informative article by Shree.Ashwini Kumar Sinha, is deeply explaing various aspects of the programming to make more use of ChatGPT.
    Even since its release, I have been experimenting with ChatGPT on “other languages?. aspect. Thru continuous chats in it, I am checking the response quality and depth of ChatGPT by conversing deeply in that language. Other than English ans some European Languages, the Data Base and Language Model in other languages is too shallow. Althouigh they assure that my feed back from my end is accepted and the Data Base is updated, the update is not reflected in the conversation subsequently.
    This idea seems very innovation and novel in that we can have a vocal conversation thru ChatGPT.
    Thanks a lot to the author.

SHARE YOUR THOUGHTS & COMMENTS

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components

Calculators