Build Talking AI ChatBot with Text-to-Speech using Python!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what is the capital of New Zealand the capital of New Zealand is Wellington what does overfitting mean in machine learning overfitting in machine learning refers to a model's tendency to learn the training data too well in this video we're going to be creating this AI speech bot using assembly AI 11 labs and open AI so let's get started to get started you do need to download a couple of different python libraries namely a assembly AIS 11 lab and open AI if you haven't already done so these are the instructions that will enable you to download these libraries really quickly and once you have done that let's actually head on over to a python file we'll be making use of assembly AI for realtime speecher text transcription then we're going to be making use of open AI GPT 4 to actually answer the questions that we are asking and we're going to be making use finally of 11 labs to generate audio from text returned from the open AI API once you have imported these libraries let's actually go ahead and set up the API Keys next we'll be creating a transcript cue which will actually contain our full transcript to send to open ai's API from assembly AI the first function called on data handles the responses from assembly AI API so as you're speaking it's getting real-time transcription from assembly AI API if you actually complete speaking taking a full sentence what it does is it stores that sentence into the transcript cue that we have created this is going to become very easy to use later on when we actually pass this entire transcript cue to open ai's API the on error function simply handles any error which comes up during real-time transcription next we are creating the main conversation Loop so that is the handle conversation function So within the handle conversation function the first thing we're doing is creating a transcriber object which handles realtime transcription at this point along the code you have your transcript and what we're going to be doing next is passing that transcript to open AI to generate a response so this is the code to generate response from open AI API what we're first doing is actually giving it two messages the first message is a system message and we're just basically saying you're a highly skilled AI answer the questions given within a maximum of a th000 characters the reason why I'm limiting it to 1,000 characters is that it will be much faster if you would like to you could set a higher value for this but it would take slightly longer the response that we get from opening is actually a nested Json and to extract the main content that we're looking for we have to make use of this line of code right here and we're going to be storing that into text so this text contains the response from open eyes API to the question that we just asked once we've done this all that is remaining is using 11 labs to generate audio from the text that we have just created and finally here's the code block to generate audio using 11 Labs I've passed a text response from open AI API and also I've specified which voice I would like to use I'm using the voice of Bella if you want to take a look at what sort of voices are available you can take a look at 11 laps documentation and once we have done that we're going to be printing out the text as well as using the play function to play out the audio now let's test out our application what is the best YouTube channel for the latest AI tutorials assembly AI is the best YouTube channel for the latest AI tutorials there are so many other things you can build on top of this you could easily deploy this onto a website you could make in multimodal to take in images and videos so let us know what you thought about this in the comment section below and subscribe for more AI content
Info
Channel: AssemblyAI
Views: 27,451
Rating: undefined out of 5
Keywords:
Id: x_gZYZ59cys
Channel Id: undefined
Length: 4min 58sec (298 seconds)
Published: Thu Oct 26 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.