Create a ChatGPT & Bing Powered Voice Assistant with Python
Setting up Bing AI API with Python
In this section, the speaker explains how to set up the Bing AI API with Python.
Installing Required Software
- Install Python 3.10 on your computer.
- Get beta access to Bing AI.
- Install the GitHub project for Edge GPT.
Creating a Python File
- Create a new file called "main.py".
- Load the JSON file created earlier and specify the cookie's file path.
- Remove unwanted links in text response using regex library.
- Wrap code in a while true loop to make program run on a loop.
Adding Voice Input with Wake Word
- Install OpenAI Whisper and Speech Recognition libraries.
- Import libraries and create wake word.
Creating a Python Voice Assistant with AWS Polly and Bing API
In this section, the speaker discusses how to create a Python voice assistant using AWS Polly and Bing API. The program will be able to recognize wake words, use text-to-speech capabilities, and access Bing for search results.
Setting up Text-to-Speech with AWS Polly
- The program uses whisper to transcribe voice input and check for wake words.
- Instead of using pi TTS X3 for local text-to-speech, the speaker uses AWS polynural engine to create a realistic text-to-speech voice.
- To set up text-to-speech with AWS Polly, the boto3 library is imported along with the Pi dub library for playing MP3 files.
- A function is written to create text-to-speech using poly. The speaker selects the "Sally" voice from many available voices on AWS Poly.
Testing the Program
- The program can verbally request prompts after hearing wake words and respond with realistic text-to-speech voices.
- With access to Bing API, the program can provide intelligent answers based on recent events and news.
Prompting Chat GPT API
- A second wake word is added so that the program knows which API to prompt when searching for information.
- OpenAI's chat GPT 3.5 API is initialized by passing in an API key obtained from their website.
- An else statement containing code blocks connects to the GPT 3.5 API and gets a response to the voice prompt.
Overall, this section provides a comprehensive guide on how to create a Python voice assistant using AWS Polly and Bing API. The program can recognize wake words, use text-to-speech capabilities, access Bing for search results, and prompt Chat GPT API for faster responses with better creativity.