The Best Ways to Use ChatGPT's New Code Interpreter

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
chat gpt's code interpreter plugin has just become available for all chat apt plus subscribers that means you can be able to execute the code the chat GPT suggests directly within your browser and see your media results I've been playing with it for the last few days and so I wanted to highlight some of the most interesting use cases that I can see for developers along with a couple of other left field examples too so with that said let's get right on with it and show you some examples so under beta features you have this code interpreter plugin and you just need to make sure that's switched on so you've got access by default you're still going to be dropped into chat GPT 3.5 so you actually need to go across to gpd4 and select the code interpreter if you want it to be enabled remember that gpd4 currently has this cap of 25 messages for every three hours so you're gonna be limited in the number of conversations you can have so you need to be sparing so I asked codons over to to write a regex of matching UK mobile numbers so this is a fairly common thing you want to match phone numbers from a piece of text I've got a couple of examples and it appears with the region codes so this can be formatted in a number of different ways and there's a bit of a pain for me to write as a regular expression I need to go through a number of iterations of this now chat jpt goes okay I can do that here's a regular expression that would match those numbers that you've suggested but the trick here is the code interpreter allows you to actually test what is said so when it suggested this I've actually gone back to it and said please can you test these code this this code that you've suggested against my examples and it goes back and actually tests these examples against the regular expression that it suggested it will outline the full code that it's done to do that this is generally hidden and we can expand it to take a look so you can see that actually in the first statement there it's saying apologies to the confusion the regular expression is not actually matching any of your test strings because they contain non-digit characters so immediately it because it I've asked it to test this it's gone back tested it and realized that what it suggested isn't correct so straight away it goes off and revises this example and it uses the this input data that is suggested there so again test these against the phone numbers and so and you can see there it's matching two of them but not the last one and suggests a different regular expression again and tries that one and you can see again it's also not matching so we've had one two three another one here where it matches all of them but actually I've noticed um in going back to it that it doesn't include the original example I gave it where it's got the leading zero there so kind of feedback to it can you include that as well the original example I gave you hasn't been included and it says okay well I include this as well so it's got the test data again so it goes back and tests against these this new test data that is created with these two extra examples and lo and behold it actually matches all of them so it's great that we can be farming off this kind of mundane task to chat GPT in order to get its work and it's great that you can test it iterate through um and show me the code that it used to generate it so I can take this python dump it straight in to a script locally and use it straight away okay so the next example wanted to show you is code review so I've got this piece of code that I've uploaded which is actually from one of the Advent code challenges within that file there's not actually it's not well documented at all there is no codes comments or anything like that and the file is named day 11 so there isn't any way you can kind of hallucinate from the file name and I've just said what does a code do in this so to describe the problem from this adventure code challenge basically there is a bunch of monkeys they all have a number of individual items there is an operation that is performed on the items that they have and depending on the operations performed means it goes to a different monkey and so at the end of that they will have different integer values after anyway basically what happens is there's a number of a ton of iterations that go on through quite a convoluted process and I'm trying to get see if chat apt can understand that it immediately identifies that it looks like it's for a programming problem possibly for a coding challenge like Advent of code this was the Advent of code from 2022 so it means that it's not going to know the answer to it because actually it's cut off date is far earlier than that the script defines monkey class each instance the monkey class has a worry stack so it's identified that all correctly the class is actually called monkey in the file so there's a bit of a dig giveaway for it um and then there's part one answer and part two answers so it reads from a file and it's reading all the input data from a file in order to process a load of things and come back with a value as an answer and I actually ask it here can you create some test data script could pass because I'm interested to know if it's identified it so well that it can actually just create some mock data for it so you can see there that it's created what looks like a correct format of it and so I just say can you run the script against the data that you created and print what the output is so it says you can't do that because it can't run arbitrary scripts but it can actually just pull that in and use it in the current session so that's what it does so following all that and after actually getting it finally loaded into the script it runs it gets these answers and um new song so we want to get ideas of whether this can be refactored and it says yeah here's a bunch of ideas and we can reduce complexity list operations avoid repeat computations etc etc so to go a little deeper uh let's look at a data set that I got from kaggle which is um of movies over the last 50 years I think it is an interesting thing about this is that I've uploaded this as an zip file so that's one interesting trick is that if your data is exceeds um a certain size you can upload a zip file and it will unzip it and understand what's in it so you can see here it's uses zip and unzips that data so it says date you've provided is movie statistics data set now I can kind of probably interpret a lot from the fact that it's named this this is what came down from kaggles so it's yeah I would have preferred it was named something else but it's able to see that it is data about movies and it has title movie and a bunch of other data um and so I go okay well give me three non-obvious insights complete reposable explanations on this data it shows it loading this data looking through it and immediately comes up with insights that are really interesting straight away there's a 18 it's 1835 unique directors and date set with some directors not specified the data set includes movies from 2458 unique production dates with the most common date being 2011. 23rd of September 2011 I don't know why the average movie run time is approximately 110 minutes anyway so the non-obvious insights is come back with a correlation of budget and success of a movie the impact of a director's experience on the success of a movie and the trend of movie genres over time and it says what it's going to need to be able to calculate those so it gets off meets those calculations and does this huge amount of you can see all these huge amount of calculations is having to convert things to date times having to strip out years from the date that is already there and we've got all these captured as steps the correlation between threats was the experience and the worldwide gross revenue is approximately 0.13 indicating a weak positive relationship this suggests that the director's experience has a minor influence on both the critical and financial success of the movie which is interesting I don't think I would have guessed that myself so based on this data it is collected I've asked it to graph these insights for me using the most appropriate charts with the type of data and you can see it comes back with these fantastic graphs of the insights that it's suggested and then I just asked to write it out to a PDF can you write these things out to PDF and it goes through the steps that it needs to do that and it creates this movie insights file so if you download that you can have a look in the PDF and you see all the graphs right now it hasn't included the analysis that I asked for but that's fine the thing I noticed in that is that actually the correlation between director's experience and worldwide gross revenue we have this weird point at 300 over 300 moves so I said who's the director who's directed over 300 movies we could have this huge Point actually turns out it's one that's not marked so you can see at the top here we have directors that are just marked as a dash I'm not sure why that is because actually some of these movies are I mean the directors I think are listed on I would assume a list on IMDb for Avengers end game Etc anyway so I realized that actually what it's done is we've got a whole load data for directors that don't exist in data so I just immediately go back and say can you filter that out an update with the new data that you've got and lo and behold it comes back with filtered movie insights PDF and was able to give me a new PDF with that data adjusted then I asked it can you draw a trend line for the director's experience graph and render it for me and it's gone through all the steps for that as well you can see that these are not in small steps they are huge and actually you can see it's correcting itself several times here um so yeah it's corrected itself several times here iterates on what it's doing and then eventually gives me a PDF of all the trend lines and that's actually ends up being for every graph not just the one that I've asked for and finally I ask it there what's the main takeaway from this data set it says so yeah the main thing being this data set suggests that while factors like budget and directors experience may have some influence on movies financial success and ratings they're not the sole determinants of its success so this kind of blows me away how um how easy it is to get interpretations from this this was probably what 10 minutes work to go through and do all of this get it filters get all the graphs if I was doing this on my own it would take ages like there's no question it would take me a ridiculous amount of time compared to that so it's incredibly impressive with the fact that we've got this ability to upload files now that we can do this sort of stuff so next let's look at image analysis so I asked it can it you detect the edges in the following image which is just an image of myself from previous video and you can see it converts it to the grayscale here it's actually a color image and then performs this Edge detection algorithm now it might not be clear from that and it wasn't to me and so I asked it to um and launch this image and you can see the outline there more clearly and it's kind of impressive that it's actually not got any of the edges of things in the background there it's actually clearly got me as an outline shape um it may well have them as gray points I guess so some more image analysis here I asked it to extract the dominant colors from uh this unsplash image of a sunset that I found and it says it can do that okay means clustering wanted to know how many colors I wanted so feedback seven shows you how to go about doing k-means clustering and detecting those I also asked for the hex codes for them because actually if we're using it for say a web development site or something like that and you can see that it happily extracts it's giving me this nice color palette so yeah I also asked it if it could zoom in on the center of this image which it also does very well so we get this nice cropped image to the center another interesting feature that code and drops has it's got the ability to OCR image text so you can upload images and have it recognize the text that's on them so I tried this with a couple of mathematical equations and unfortunately it didn't recognize a few of them so I tried this with a Hilbert curve and traveling salesman problem and it didn't recognize either of them it was actually only when I update uploaded a simple literally quadratic equation that recognized the text in that and it was able to identify that it represents a quadratic equation so you might have a better experience than me but I think that basically where Things fall over multiple lines in some of these equations that it's going to struggle be able to recognize them there's been a lot of examples of using the code interpreter for creating videos and doing these kind of zoom out images I did trying to do that and failed quite miserably it basically was running out of memory and it kept doing it I tried it a number of different times and it felt pretty miserably at that so you wouldn't be able to use it for video creation and they were fairly basic videos anyway so I don't think it's something you want to use it for I was able to create a gif animation using green Matrix letters so you might have seen this is also tried it out for myself um again shows you how to create this in Python and has a number of different frames where the letters are falling down I think a few of these I'm going to be using but majority of them day to day are not going to be useful the data analysis side of this is really useful and I think that's the main thing that developers should be looking for this for so yeah I hope you enjoyed the video I'll be checking this out more over the coming weeks and seeing what else I can do with it um if you like the video then consider subscribing to the channel give it a thumbs up all that sort of social stuff and I'll speak to you soon new video all right bye for now bye
Info
Channel: Ian Wootten
Views: 375
Rating: undefined out of 5
Keywords:
Id: Zfxt5wRa6Zg
Channel Id: undefined
Length: 15min 2sec (902 seconds)
Published: Fri Jul 14 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.