Skip to main content

Raspberry Pi Setup for Voice Assistant Applications Using ChatGPT, Whisper API, gTTS and Pysstx3

 

Raspberry Pi can be used for providing voice assistant capabilities by integrating with ChatGPT and Whisper APIs from OpenAI.

This article shows how to set up the required libraries such as Chat GPT, Whisper API, Text-to-speech Pysttx3 etc., on Raspberry Pi for enabling voice assistant  applications.

 


Hardware components


Raspberry pi operating system needs to be installed on a micro SD card before installing any ChatGPT based libraries. Raspberry Pi Imager running on another computer can be used to copy the operating system into the SD card. 



Click on 'CHOOSE OS' button and select Raspberry Pi OS (64-bit) option and select 'WRITE' button to install the operating system on the SD card.





After installing Raspberry pi os on SD card, it can be inserted into Raspberry pi and connect to Monitor and keyboard for installing the required voice assistant integrations. First setup username and password.




Select Preferences -> Raspberry Pi Configuration.

Click on the Interfaces tab and select SSH and VNC. These options will enable you to access Raspberry pi remotely using SSH or VNC.


Advanced configurations can be set using raspi-config comand on the Terminal.
sudo raspi-config

Select System -> Audio -> USB Audio








Sound settings can be modified using alsamixer command on the Termial.

                           








Install openai library and then install gpt_index which is also known as LlamaIndex (GPT Index) is a project that provides a central interface to connect your LLM's with external data. Install PyPDF2 library which can be used for processing PDF files.
pip install openai==0.27.4
pip install gpt_index==0.4.24
pip install PyPDF2
Install longchain library which is a framework for developing applications powered by language models. Also install tiktokpn, a tokenizer library and PyCryptodome which provides encryption and decryption algorithms.
 pip install langchain==0.0.132
pip install PyCryptodome
pip install tiktoken==0.3.3

sudo apt-get install libasound-dev
sudo apt-get install portaudio19-dev
pip install PyAudio

Install epseak, speechRecoginition and text to speech library (pyttsx3) libraries.

sudo apt-get install espeak
pip install SpeechRecognition
pip install pyttsx3
Install gTTS (Google Text-to-Speech) library.
pip install gTTS
pip install playsound
pip install pygobject

Comments

Popular posts from this blog

Water Leak Detection Notifications

Water Leak Detection Project with GrovePi  and Hologram Nova This project uses the Grove water sensor that can detect water leaks, spills, floods, and rain. It also can send notifications using cellular network. Things used in this project: Hardware components: Raspberry Pi Zero W or WH GrovePi Zero  Grove Water Sensor Grove LCD RGB Backlight Hologram SIM Software Apps: GrovePi  Python Hologram CLI Water sensor module from Grove system provides  the ability to detect if there is any water leak by measuring conductivity. The water sensor traces have a weak pull-up resistor of 1 MΩ and it pulls the sensor trace value high until a drop of water shorts the sensor trace to the grounded trace. GrovePi Zero is a HAT from Dexter Industries   that allows Grove Water sensor to connect to Raspberry Pi zero with out needing soldering or breadboards. One can plug in the Grove water sensor start programming. Grove water sensor works with digital I/...

ChatGPT Voice Assistant for Raspberry Pi Using ChatGPT, Whisper API, Speech Recognition and Pyttsx3

  OpenAI provides API for ChatGPT and Whisper models that would enable developers to access cutting-edge language and speech to text capabilities. This article shows how to use the ChatGPT and Whisper APIs from OpenAI along with Speech Recognition and text to Text-to-Speech libraries to build a voice-enabled chatbot.  Th e i nstallation instructions required Chat GPT and Whisper etc., libraries are provided  here  . First Connect USB Microphone and USB Speaker to Raspberry pi. The Chat GPT  library needs to be configured with an account's secret key which is available on the   website . Set the api key  OPENAI_API_KEY. OPENAI_API_KEY = 'Your API Key Here' openai.api_key = OPENAI_API_KEY Use the  Recognizer class from the Speech Recognition library to recognize spoken words and phrases. if __name__ == "__main__": # create a recognizer recoginzer = sr.Recognizer() mcrophone = sr.Microphone() # start the bot voice_bot(mcro...