Automating Boring Tasks Using ChatGPT and Python

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
recently chat GPT was released this is an AI chatbot developed by open AI that specializes in dialogue its goal is to make AI systems more natural to interact with but it can also help you when writing code you can make chat GPT your coding assistant or even go beyond that and in this video I'm going to show you how to use chat GPT to write python code to solve some coding tasks such as plotting graphs sending emails and messages and doing web scraping in just a couple of seconds so let's get started before we start with this video I'd like to thank median for supporting me as a content creator medium is a platform where you can find python tutorials data science guides and more you can get unlimited access to every guide on median for five dollars a month using the link in the description okay now we're on the chat GPT website and as you can see here chat GPT is optimized for dialogue so you can ask something like explain Quantum computing in simple terms or you can ask chat GPT to write an essay for you but in this video we're going to test cap gbt solving some coding tasks so for example we can ask chat gbt to do things like send an email using python or any other program language you only have to go here to this box and write whatever you want so in this case just to start with something very simple I'm going to say plot a linear regression and here you can be very specific and say the programming language you want to use I'm going to say with python and you can be more specific by writing the library if you don't write the library chat GPT is going to choose any library but I'm going to specify this one so I'm going to say using matplotlip so I'm going to press enter and now chat gbt is gonna read this and it's going to interpret what I'm requesting so it's going to plot a linear regression using Python and the library matplotlib and now it takes a couple of seconds and finally it understood so it says to plot a linear regression with python you can use a scatter or you can use uh this uh this module and well now it's doing all of this it's writing the code and it's even uh writing some comments so first it's generating some fake data and then it's fitting this a linear regression to the data I'm not doing anything and at the end of this uh when chat GPT finishes doing this I'm going to copy this and I'm going to paste this on Jupiter notebook to test if everything is correct so now we have uh some some suggestions by chat gbt this will generate a scatter plot but it's giving an alternative so here we can have another way to do this but I don't I don't care about that I'm gonna copy this because I believe with this is enough so I'm gonna copy and as you can see it gives you not only the code but some nice comments here comments and hear explanation about what it's doing so it's not only about the the code but it also gives you some explanation so now I copied this I'm gonna paste it and I'm gonna check if this is correct so here it says that I don't have the modules High Pi so I'm going to install it here okay I've just installed sci-fi and now let's see if it does the job and now as we can see this gave an error so fortunately chat GPT gave us an alternative so here it says alternatively you can use these other option so I'm going to copy this and actually when I tested this before this was the only alternative so I'm going to copy and paste this one and as you can see now we got this uh this linear regression and well we generated this using chat DBT so fortunately we have here two options all right now let's go continue testing this and now let's try something else so let's try sending a message on WhatsApp using Python and to do this we need a third-party Library named Pi watt kit so I'm gonna say something like this send a message on WhatsApp using Python and Pi watt kit so let's see if this AI recognizes this pie what kit it's not so popular this Library so let's test this out so I'm saying send a message on WhatsApp using Python and Pie what kit you can add more detail like uh adding the your phone number but obviously in this video I'm not gonna show my phone number so you can test it out on your own and now we see the trdbt is writing the code to send a message using part white Kit so we see all the code this will cancel the message to be sent at the specified time so we have to specify here the hour and the minute we have 12 30 by default but we can change it note that you need to install pivot kit of course this is the module and have a working internet connection you also need to have the latest version of Chrome yeah uh install on your computer and I know all of this because I have a tutorial on how to send a message on WhatsApp using Python and using this Library so I know that this is correct so you can copy this actually and you can paste it on python for example here you can write your number or the number of anybody you have to install this library right here the message you want and that's it you can send the message on WhatsApp I'm gonna show you here uh the example I did in the previous tutorial when I wrote the code on my own but of course here it's with this uh AI chat GPT okay now let's go back here and let's continue testing before here I wrote send a message on WhatsApp using Python and piwotkit but what if now we want to be more specific let's try sending an email and now I'm going to specify that email that is going to be the sender and the email that is going to be the receiver also the subject for the email and the content that the email has so that's a lot of details let's see if chat GPT can handle this so here I'm going to paste this command that I had before and this is going to help us see if chat GPT can handle so many details so here it says send an email from email1 for example here I'm gonna write my my own email this is the email that I'm going to use and then for the receiver I'm gonna write another email that I have that actually I don't use so often but I'm gonna use for this test here I have send an email from my first email that I'm using for this example to my second email with the subject email sent by chat gbt and the content chat GPT rocks using python so let's press enter and let's test this out so this is a very uh I'm not gonna say complex but I would say it is challenging to understand all of this and to execute that without any mistake so let's see if this AI can handle all of this so first it's trying to understand all of the the request with this explanation so it says to send an email with the subject we have to use a SMTP leap and yeah that's the library uh that we used to send emails with python so now it's writing the code it's writing comments the sender the repeat P there recipient sorry then it's uh connecting to SMTP server yeah we need to do something like that it's telling us uh some details and is adding a note so note that you need to have a working internet of course in a valid email account uh you also need to allow yeah this is that note so you also need to allow less secure apps to access your email account but it doesn't say anything about that 16 character password so in the past you could send emails just allowing less secure apps but nowadays or recently you have to add two S10 verification and also create a 16 character password so GPT doesn't know about that but how you know about that because I have a tutorial on that but ignoring that let's see if that works so here I have the code and so far I have to say that this looks good we have the sender we have the recipient the subject and the content so it seems everything is perfect just one thing that we have to keep in mind is the password so here for the sake of this video I'm gonna hide my password in this email underscore password variable I'm gonna uh delete my password that was in quotes and I'm gonna write this variable so now let's test this out I'm gonna run this and see what happens so we have process finish with x equals zero so apparently everything was successful and now I'm gonna check my email okay I log into my email and as you can see here I have a new email that says email sent by chat GPT and the content is chat DBT rocks and well as you can see I also did a test uh like three hours before this one and we can see that everything works successfully and we didn't have to write all of this code but chat GPT did it for us and this is just awesome so now let's do something more challenging now let's try to scrape our website with tab gbt so I'm gonna give a task to chat GPT something like this so web scrape and then I'm going to write the link of a website so I'm going to use this website here books to scrape.com and then I'm gonna set using python force and here we can specify the library or you can leave it as is in this case I'm going to say and beautiful too so beautiful soup is a python library that allows us to scrape websites I'm going to describe this website and before I press enter let's have a look to this website so this is the websitebookstoscribe.com and we're going to scrape maybe the title or the prices I'm not going to specify what data I want from this website but I'm gonna let chat DBT figure this out on its own so I'm going to press enter and let's see what this AI does so sometimes it takes more than a couple of seconds but you have to be patient because some tasks are very challenging so this is very good uh I think it successfully extracted the price we can see here that we have the price and also the title so it's printing that title and also the price so here it didn't export the data I know that because it's not exporting that txt file or a CSV file but only printing but in the previous test I did it exported a file with all the data in this case I'm going to leave it as is so I'm going back here the pie charm copy and paste it and let's see if this works smoothly so here I run this and here we have the price sorry the title first and then the price so let's verify if this is correct so here we have a light in the attic 51.77 I think this is this is the symbol of pounds and yeah we have this and then Tipping the Velvet 53.74 and yeah so we successfully scrape all of this data using uh actually chat GPT I mean we can say we used we took but we didn't write the code chat gbt did all on its own and this is awesome so as I said before you can give more instructions to this AI so you can tell this AI to to export this in a txt file in a CSV file or maybe to scrape more websites because this is a very simple website maybe you can tell chatgpt to scrape Amazon or any other website I don't know how it will go because I didn't test that out I just did some simple tests but you can test that on your own and write what you think about this AI on the comment section below
Info
Channel: The PyCoach
Views: 132,300
Rating: undefined out of 5
Keywords:
Id: fgFHYZFO8Yo
Channel Id: undefined
Length: 12min 38sec (758 seconds)
Published: Fri Dec 09 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.