Automating My Life with Python & ChatGPT: Coding My Own Virtual Voice Assistant | Code With Me

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
yeah if you know me by now you know I love to automate pretty much anything in my life that I can and I love to use Python A lot of times to do it some of you've been asking for JavaScript tutorials which will be coming soon as well but today we are going to be essentially automating our life wait let me rephrase that not just automating our life but creating for ourselves our own little assistant essentially with the use of python and getting chat GPT to help I wanted to include chat GPT in this tutorial going through automating with python and creating a voice assistant for us because the reality is chat GPT is a tool that developers will continue to use in their day-to-day lives or very frequently and rather than pushing it to the side but as it continues to get smarter and data gets updated we need to embrace it and start using it okay I kind of gave it away what we're building today but we are building a virtual assistant so we will be using python chat GPT to use a virtual assistant that we can actually give voice commands to it will respond to and track what kind of tasks we are giving so it's two-way interactive voice assistant that's virtual that will be running in the background and can listen for a certain commands this is super cool and I was blown away how easy it is to make this voice assistant let's get into it foreign here I have chat GPT and we're going to give it a command that will build a python project for us that will create a voice assistant so we are able to speak to our computer and it is listening and then it will reply so this could be to-do list I was thinking it could also be set a reminder let's let's get into it so let's paste this here use Python to build a voice assistant that can help you with tasks like setting reminders creating to-do lists and searching the web that was really cool you can use speech recognition libraries like speech recognition and Pi TTS X3 my pronunciation on specific modules or packages is really bad so if I'm saying it's terrible let me know I'm still kind of new to python honestly I've been a JavaScript developer for six plus years professionally but python is something that I would say up until about a year and a half ago I really started tinkering with and it just like exploded my love for it because it's so cool and so friendly and so many things you can build anyways as a side note let's see what it says you can see though when I did this prompt I was pretty specific as things of what packages to use uh what I wanted to do for the task so the more specific you are the better result you will get all right let's see it's generating we'll speed this up [Music] so you can see here on screen it wrote the code for us and it also gives comments as well as to what it is doing so let's kind of go through this as you can see here we're defining a function to speak the text so what we will say and it will be running and waiting and then as well listening so Define a function to recognize a speech so print speak now then when it is listening down here if we scroll you can say remind me in the command create a to-do list and also search for so let's take this code now knowing that we're going to have to install some modules and whatnot actually it sets that up here copy code and create a vs code project or a project in vs code so we can run this locally let's do it okay so now you can see we have vs code open and this is just an empty folder that I put into it so if we go into new terminal here make sure you're in the actual project python Voice Assistant actually I'll link this project in my GitHub down below as well so if you want to follow along that way all right next what we need to do is create our main file so let's just go main.py and there we go and now let's initiate a virtual environment what this will do is it will allow us to install different modules and packages and run all of those packages and modules just within this project so you can continue to build other projects outside of this and you'll have to re-install any packages you want to use again but this is a great way to kind of contain the invert the virtual environment I can't speak today and it's and I've already had like coffee maybe too much coffee is the issue all right first thing we are going to do is type in Python three because I'm using three and then we're going to do and what this will do is oh here we go we notice the environment has created you want to select it for work on that you can see here now it has created this new environment folder then let's go into this environment folder perfect and now you can see we are in the environment now we are able to install different packages so if we go back to chat GPT here where are you this is a problem with too many screens all right let's do this pip install speech recognition and py double tx3 I always feel like a hacker when it's like doing this it's doing it's just installing like I'm not doing anything but it feels so cool all right so then if we go back into chat GPT let's copy this code and okay so we just pasted in the code here and then if you are getting this warning that it's not uh cannot be resolved just exit out of it [Music] we did install you [Music] all right all right let's try closing the project and reopening it it's giving us a little difficulties but it's already installed okay so I had to shut down vs code completely and then it started working so as you can see here we have our code and we kind of went through it but as I mentioned chat GPT will give you pretty good comments as well so now one thing I want to note though is which chat GPT will not tell you is if this is your first time importing speech recognition package you actually have to do something else let's go back to chat GPT here and if I go here um this is the error you will get if you try running the code and you've never used speech recognition before is it here it's right here so uh failed failed building wheel for pi audio and essentially what it is is because speech recognition is part of a bigger Library so you actually have to you can see here for Windows Linux I just used Brew install Port audio once you do that Brew install Port audio then it will allow you to start using the speech recognition Library if you've used it before you won't run into this but if you if you're your first time you will run into this error and then you just need to install run one of these commands depending on what what computer what operating system you are using all right let's go back into vs code here and let's just run this and see what happens run Python and terminal oh it is saying same thing we're getting the same thing they just told you all right maybe I just installed it last time in my project well let's do it again so coffee code Port audio paste maybe I just installed that's what it was okay so now let's try again let's go run [Music] this isn't supposed to happen okay so what I did not install I'm just going too fast here for you and for me apparently uh not for you for me but no what I didn't do is after I saw installed that package with Brew I also need to install Pi audio so make sure you run this command as well then what we can do I already ran it so I'm not going to again then right click and run python in terminal let's say create a to-do list create a to-do list oh you know what I gotta do I gotta unplug my computer it's because of the audio one sec here let's do this I have it set up on my monitors and I don't think my audio is connected to it so I want here [Music] okay let's try this again create a to-do list what the heck okay we gotta run this again create a to-do list what are the tasks you want to add to the to-do list pick up groceries go for a walk finish coding project stop here's your to-do list one go for a walk two project so it's not perfect as you can see and it's really cool so where I'm getting these from is you can see here set reminder remind me create a to-do list search for and then you'll have to actually for the search for one add some further code which is super simple you can just follow along with chatgpt for in the prompts for it you can click on or you can say quit or if it does not understand we'll say I'm sorry I didn't understand so say blah blah blah blah no it's still very finicky but it's not so cool you can now say you made your own voice assistant and this is what comes out of the box so you can get really creative with this what should I remind you about okay there we go it's listening remind me to go to sleep tonight sure I'll remind you to there we go it's listening remind me to go to sleep tonight later listen no one said this was perfect okay but it is such a fun project and it's a really great thing to include in a bigger project or to start tinkering around with and really stand out to Future employers as well by building these different uh automation tools or tasks that can be part of something bigger to show that you're really creative and utilizing different tools out there and I think it's a really great really fun project I'm linking it down below all right we finished it in record time we were able to do that really quickly I think it really goes to show just how powerful it is that with chat GPT it's one of those things that anything any idea that you have and the understanding of how to code you can know build it at your fingertips even if you are just starting out you can now use something like Chachi BT to help you build the missing pieces you might not understand debug with it and in turn build things that you never even thought were possible for you to build Maybe be where you're at in your skill level I hope you all enjoyed this tutorial and also to start using these voice assistants it's so cool I just I showed uh some friends this before I filmed this version of it and I'll be showing them and you know it's very simple to build but when you show non-technical people they're like this is so you built this I'm like yeah I built it with Chad gpg but anyways uh leave in the comments what we should automate with our lives for our lives next with python we can also try some things with JavaScript and if you haven't already make sure to hit that subscribe button it means a lot to me your support and uh I will see you all soon thanks everyone foreign [Music]
Info
Channel: Tiff In Tech
Views: 294,433
Rating: undefined out of 5
Keywords: Automating My Life with Python, tiff in tech, tiffintech, python automation, python automation projects, python tutorial, python for beginners, learn to code, python programming, python projects, automate your life, how to code, how to start coding, python project ideas, coding tutorial, learning to code, code with me, how to learn to code, how to learn code, automation python, how to learn programming, coding for beginners, women in tech, How to learn coding
Id: zzW5z2r9Fh0
Channel Id: undefined
Length: 12min 9sec (729 seconds)
Published: Tue Mar 14 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.