Free Shipping on orders over US$49.99

How To Convert ChatGPT Into An Advanced Voice Assistant

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.

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

Source link

We will be happy to hear your thoughts

Leave a reply

Enable registration in settings - general
Compare items
  • Total (0)
Shopping cart