ChatGPT and Raspberry Pi, building a personal voice assistant using AI

GPT assistant, chatgpt and raspberry pi

How would you like to get a personal voice assistant using ChatGPT and Raspberry Pi? They have managed to set up, with very few resources, a personal assistant that recognizes the voice and returns the answers with a human voice.

Since ChatGPT appeared, the different assistants on the market -we will use the most popular ones, Siri or Alexa, as an example-, have been falling behind. And it is that OpenAI's ChatGPT are making waves around the world with their capabilities. Even some sectors already fear him; Could he be an imposter in some trades? The debate is open and its regulation is on the table. Leaving aside the issue of legality and its use, in this article we are going to show you how they have managed to build a personal voice assistant using the ChatGPT chatbot and a Raspberry Pi.

What is needed to carry out the project and set up our voice assistant ChatGPT?

The user Edwight Delgado has achieved -based on another user's project nickbild– carry out the project with very few resources and which he has baptized as gpt assistant. If you want to reproduce his feat, what you will need is the following:

  • Raspberry Pi 4
  • A microphone that connects via USB or 3,5mm jack
  • A speaker

GPT assistant modes of operation

GPT wizard, how it works

Before giving you all the keys to start the project, we will explain how it works. First of all, Edwight has used Google technology GTTS -Google text-to-speech- so that ChatGPT translates the text received into speech and thus be able to project it, later, through the speaker that we use for the project.

Likewise, ChatGPT and Raspberry Pi will be understood well thanks to the fact that the user -you in this case- will speak through the microphone that you have connected to your Raspberry Pi. This message is received by the bookstore speech_recognition which will translate that spoken message to text. Subsequently it will be sent to ChatGPT so that it can respond and your message will also be translated in reverse; that is to say, with Google's technology, the text response will be translated -or converted- into a whole message by voice, in the purest style of Amazon's Alexa or Apple's Siri. It will all work that simple.

The GPT installation wizard on the Raspberry Pi

The first thing you will have to do is create the virtual environment:

python 3 -m venv venv

Secondly, you will have to activate the environment in bash or with fish:

source venv/bin/activate
source venv/bin/activate.fish

After that step, you must install the necessary packages and libraries as follows:

pip install requirements.txt

Finally, you must rename the .env.example file to .env and change the token of the file to that of the ChatGPT page. To get the token, you must enter the OpenAI official page and the content of auth-session-token you will need to copy it into the .env file. You will have it ready.

GPT token assistant

Image by Edwight Delgado

What will you have to do to get the GPT assistant up and running?

If everything has gone successfully, your GPT assistant will now be ready to use. As we have mentioned before, now is the time to put everything installed into practice and start by asking the GPT assistant any questions. To invoke the assistant -and just like the other voice assistants work- it is to say his name before any question. In this case, the keyword to wake it up is GPT. From that moment, you can ask what you prefer. Now, first of all you must enter the script to run it:

python voice_chat.py

At that precise moment, GPT Assistant will greet you and offer its help. That is, your answer will be the following:

'Hola, ¿en qué puedo ayudarte?'

You will have to wait a few seconds and ask him the question through the microphone connected to the system. As we have told you before, you must say their name first and then the question you want to ask. An example:

'GPT, ¿recomiéndame un buen restaurante cerca de mi posición'

The bot's response should appear within a few seconds. And through a digitized human voice. On the other hand, if you want to finish asking, You must also close the session by voice saying only 'Goodbye" or "Thanks a lot and goodbye'.

Meanwhile, according to Nickbild, he assures -according to his experience- that the experience is much better than what can be received from assistants like Amazon Alexa or Google Home. However, for the moment, to wake up the GPT wizard, the script must be started and not by a voice command. Now, he has ensured that the project does not want to leave it that way and is already working on the way to wake up GPT voice assistant by means of a command in the purest style 'Hey, GPT'. That is, the wizard continues to work in the background and can be invoked at any time while the computer is running. Finally, we leave you a video demonstration of how the project works.


A comment, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Pablo said

    I appreciate this post, I was doing everything manually using chrome extensions so that chat gpt could talk, but I was missing something more "viable"

    Would there be a way within the files to change the "activation" of gpt voice?