Code Interpreter Plugin
In this lesson, we’re going to dive into the exciting world of Chat GPT’s code interpreter feature. Here’s what you can expect:
- We’ll start by introducing you to the code interpreter, which is like a mini-computer with its own memory and processing power. It’s a feature of the paid version of Chat GPT, and it can hold and perform tasks on various types of files.
- We’ll explore the different file types that the code interpreter can handle, including text files, data files, image files, Python files, markdown files, and database files.
- You’ll learn how to manipulate images using the code interpreter. We’ll cover tasks like resizing, cropping, adjusting brightness, compressing, applying blur filters, and converting images.
- We’ll also delve into video manipulation. You’ll see how to apply grayscale filters, flip videos vertically, convert video clips into GIFs, and even create slideshows from multiple images.
- We’ll touch on audio file manipulation as well, including tasks like converting and mixing audio files.
- We’ll then move on to data analysis tasks. You’ll learn how to generate charts from data in CSV or Excel files, providing you with valuable insights into your data.
- We’ll also discuss the limitations of the code interpreter, including the maximum processing time and file size limits.
Remember, this is a hands-on lesson, so we’ll be working with actual files and seeing the results of our commands in real-time. By the end of this lesson, you’ll have a solid understanding of how to use the code interpreter to perform a wide range of tasks. So, let’s dive in and start exploring!
Transcript
So here we are, then, at our code interpreter training. Now, you will need the paid version of Chat GPT to be able to use this. And then you’ll need to go to GPT 4 at the top, and then code interpreter; just make sure that it’s selected. If you don’t see this as an option, all you need to do is open up your sidebar, go to settings, and then beta features, and make sure that you’ve switched it on just there. And then that is it. You now have access to start uploading files, as you can see right here. And then I’ve also made a big list of prompts for some things that you can do with this, which is a lot. And to really explain what this is, think of code interpreter as like a minicomputer with its own memory, processing power, and ability to hold files for you, all contained on its own within that chat that you initiate with code interpreter. So that hopefully gives you an overview of it. Now, the other thing is that there are limitations at the time of doing this video in terms of how much processing power and how much space you have. Now, while they don’t really publicly tell you exactly what those limitations are, especially in terms of file sizes that you can upload and everything, what I can tell you is that if you’re running some Python code, which is the code that the code interpreter uses, and it takes longer than 120 seconds, or two minutes, to generate that code, it will time out. So there is a limitation on how much coding it can do. And so it will stop at that point. So bear that in mind; you can’t really be getting it to write huge scripts that do really complex things at this time. So let’s take a look at the list of prompts that I’ve created for you. Here we go. So we’ve got them separated out into four different tabs. And the first one is all of the file types that the code interpreter can deal with. So we’ve got text files, data files, image files, Python files, markdown, and then all of these other ones here as well, databases, some of which you may never use, but at least you know which ones you’re able to use with the code interpreter. Then I’ve got a whole list of prompts that you will find really useful for images and for video because you can upload videos and have it do all sorts of stuff with videos, and we’re going to be going through that in this lesson. There you go: video, text, annotations, and video transformations. There are so many different things. And the same with audio as well. You can deal with audio files like MP3s and maybe your podcast and cut it up. You can do loads of useful things with it. Then we have data and analysis. That’s another really big part of using the code interpreter because we’re able to upload things like CSV files and Excel files that have tonnes of data in them and then ask questions about that data to get some really useful answers and get it to generate different types of charts. And what I’ve also done to help you a little bit here is to give you a list of chart types so that you can request the data in those formats. And then we’ve given you here some really simple, good explanations of what each chart is for, so that you understand whether it’s the one for you to use or not. So that’s the prompt sheet. You can access it by clicking on it underneath this video. And if you’ve never accessed any other sheets before in this training course, then you’ll just have to wait for us to approve you. Otherwise, you should get straight into the folder and be able to grab this sheet, which is called Code Interpreter Prompts V1. So now let’s get to work and actually start using this, and I’ll show you how it’s done. So why don’t we first try cropping an image? So if we go here, what we would do is upload an image first. I’m going to upload this image just so that you can see it. It’s a city there, somewhere, maybe in Hong Kong. And then I’m going to upload it, and then I’ll just ask it to resize it. So pretty much exactly what we’ve said in the prompt here is to resize my image. Let’s do this prompt here. Crop my image to a 400 by 400 square from the centre. Let’s put that in there and see if we can get it to do that. So what it will do is start creating the Python code that it needs to achieve that task. And you can actually see it if you press this open button here. And it says that it’s finished. And there you go. Look at that. Done in seconds. And there we go. Once you’ve got the image in front of you, you just click the link. It says starting download, and then there it is on our desktop, and we can open it up. I’ll just drag that over. There it is. So it’s really quick and easy to follow these prompts. Then let’s take a look at some other prompts that we’ve got there. We can adjust the brightness of the image. Now, that’s quite a good one too. Can you also adjust the brightness of the image and increase it by 30%? There we go. So I use good old Mac dictation as usual to put the prompts in. And again, now it will get to work, and it’s already finished doing that. So it’s very, very quick. And although I would say there is a noticeable difference, Yeah, there is a noticeable difference between the two. We can see that it is definitely brighter than the one above. It looks dull in that area. And then here’s something that’s really brightened it up. We can also do things like compress the image. So I’m going to upload a whole new image here. And this particular one is this crazy futuristic city that I picked for this example. And we can ask it to compress the image. Can you make this image’s file size smaller by compressing it? And off we go. So even though I hashed out that prompt, it will probably still understand me and then get the job done again really quickly. So what’s it saying now? Show work. There it is. Getting to it It hasn’t completed it yet, but there we are, done. Now it is. Look at that. You can download it using this link. And it says, Please note that there might be a slight reduction in image quality due to the compression, which is fine, but it doesn’t actually look too bad at all to me. So let’s open it up. Again, there we are. So file size-wise, let’s have a look and see if there’s a difference in the file size. So I will take a little look here and find out for you. If we go to get information, there we are. This is the compressed file size, and it says that it is 2.6 megabytes. The original file was actually 2.7, so it hasn’t been compressed a whole bunch because it’s actually quite hard to do with a PNG. But if you were to do it with a JPEG or something like that, I think you could say that you want to compress it by a certain percentage, and it will bring it right down. You just have to be careful not to lose quality. But that at least gives you an idea of how to do some really cool things with images. But there’s other stuff you can do as well. So you can apply a blur filter. So why don’t we just try that with that image right there? Can you apply a 20% blur to that image? And the good thing is that it imports anything that it doesn’t have from all of these Python libraries. And there you go. It said that it applied a 20% blur. That’s not an awful lot, to be honest with you. So I probably should have actually said more in the example. But we can take a little look at it and just see if we can see it from here. Let’s take a look. Yeah, I would say that’s probably not noticeable. I probably needed to do it more, like maybe 50% or something like that, to really blur it up. But there are a whole bunch of different things that you can do. So you can play around with all of these and upload an image, and then you can convert images. I think that a really useful function of this is being able to actually convert the images from, say, a PNG to a JPEG or a BMP to a PNG. All of these things you have to go to a website for usually. Some of them are covered in ads, and some of them don’t work. So it’s nice to be able to use ChatGBT to do these basic changes, like making an image black and white, for example, which is really good. Those are some things you can do with images. One more thing that I wanted to show you is that you can actually create a slideshow from some images. But what the ChatGBT Code interpreter does not allow you to do is upload multiple files. So you can drag them on, mind you. Look at this. You can just drag the file in there. There’s a hint for you to save pressing the plus icon every time. However, we can’t grab two or three different images and put them on because it will tell us that only one file at a time is supported. So how do you get around that? Well, what we do is create a new folder for our images, and then we put the images in the folder, and then we will turn it into a zip file, which I’ve now done. And now we can upload that file full of images because it has the capability to unzip the file. So anytime you want to upload multiple files, put them in a zip file, upload them, and then carry on with your normal prompting. So let’s just ask and see if we can get it to make us a slideshow from the images contained in that zip file. Can you make a slideshow video as an MP4 from the images contained in the folder? Now, sometimes it will struggle with this. It may, but usually the good thing about a code interpreter is that it solves its own problems. So it comes up against an issue, then thinks, Right, what do I have to do about that? It’s a little bit like AutoGPT, if you’ve seen or heard about AutoGPT, but it’s all taken place here. So here we go. Here’s the first error. Finally, it has gone through all the motions and created a slideshow video from the images. That’s what it says. So let’s now download that file, take a little look, and see if it’s managed to do it. So it is MP4, 1,349 kilobytes. Let’s open it up, move it into shot, and press play. Okay, it literally has all of the images in a slideshow. Now, we didn’t specify the number of seconds in between. We didn’t specify if we wanted to fade from one picture to the next or anything like that. So it literally just did it. But that does give you an example of how powerful it is and what you can do using a code interpreter. Now, let’s try one of these prompts for video. So what we’ll do is try to apply a grayscale filter to the video that it created for us. So that’s just here. And we’ll just ask it to do that and give us it back now with that grayscale filter. Please apply a grayscale filter to the video and provide me with the download link when finished. There we are. I have successfully applied a grayscale scale filter to your video. Here’s the link. And again, we’ll see if that has worked. There it is. It looks very nice, actually, in this city. Look at that. It’s beautiful. Let’s see if it’s done it to every single picture. And yes, it has. So that was really quick, actually. It just took, I would say, maybe 30 seconds or something like that. But the other thing to bear in mind, of course, at the time of doing this video is that we are limited to a certain amount of messages using GPT 4 and the code interpreter. I think it’s between 25 and 3 hours. So you can quickly go through that if you’re doing this a lot, which is why I have two accounts. I need two accounts to be able to do all these demonstrations. Next up, let’s take a look at what else we can do with video. So we can convert a video clip file into a GIF. That could be useful. An animated GIF. So now let’s ask it to do that. Please convert the grade-scale video into an animated GIF. Done. I have successfully converted your grayscale video into an animated GIF. Let’s get that downloaded and try it out. Okay. Now, I think when we launch it in preview on the Mac, we won’t see it. But you can see all the images. I think if I open a new window and then drag that over, we should be able to see it. There you go. Look at that. So it’s animated. Now, let’s try something else. We’re going to flip the video vertically. Let’s see if we can do that. We go up here, and I’m just going to start a new chat, I think, because it can get a little bit overwhelming if you keep doing everything within the one chat. We’ll upload the file, which is this one here, the MP4. And then I’m going to say, Can you please flip the video vertically? Let’s see if we can flip it up. Here we go. It’s going to use the Movie Pi library to accomplish this. Let’s begin the process. Off it goes. And it says it’s finished already. I’ve successfully flipped your video. Have you, though? Let’s see. Yes, it has. It definitely did. So these are just fun examples, but you can see that now and again, this is going to come in really handy depending on what it is that you do in your career or your business. But these little things could be very useful to save you from buying other software, for example. And the same thing applies for audio. We’re able to convert audio files. We’re able to mix them together into a single file. That’s the same with any document as well. For example, if you have two PDFs, you can just upload them in a zip file and say, Please combine these two PDFs into one. Same with any video, same with any audio. So there are a lot of different prompts there. Go through and have a little look. You can see that it tells you about the placeholders that we’ve got in the prompts there. So you can just replace the placeholders with your information, and then you’re good to go. So now let’s move on to data analysis. So what we’re going to do now is use some data that I’ve downloaded from my YouTube channel and upload it here. And then we’re going to use that data to try to extract some useful information. So here is the file, and then I’m going to ask it to give me 10 interesting charts created from that data. Can you provide me with 10 useful charts about the data included in the zip file that relates to my YouTube channel? And it goes. So let’s see what it’s going to find when it unzips the files. And here we are. It’s found the three different CSV files: chart, data, totals, and table data. And then it’s going to take a look at what’s included in each column so it can understand what might be best to do with that information. So totals and the table, data right there, video publish time, views So you could ask it all sorts of interesting questions, like, based on the number of views, which is the most successful time to publish a video, for example. You can do things like that. So why don’t we now? Here is what it says: Now that we understand the data, we can start generating some useful charts. Please let me know. Yeah, okay. So please surprise me and give me what you think is the most useful information that can be obtained from that data in the form of charts. Done. That’s the easy way to get it done. All right, I will create several charts that may provide valuable insights into your YouTube channel’s performance. Here’s what I’m thinking. Top five videos by views; top five videos by revenue I have views versus subscribers. That’s cool. Yeah, why don’t we take a look at this? Revenue distribution, and then watch time versus views scatter plot chart. So there’s certainly a good variety of charts with a lot of scatter plots there. And off it goes. Here are the charts: Let’s put them all on one big sheet here. Views over time, top five views Let’s zoom in now and just take a little look. Top five videos by revenue Here we go. Chat GPT Code Interpreter’s amazing use examples have generated me just over $350. So that was a good video. Train Chat GPT on your data using an easy method; that’s nearly $300. And then we’ve got views over time. So up and down, quite crazy. This is only within the last 28 days. And then we’ve got the top five videos by views. The one prompt to rule them all always gets loads of views. Very lucky with that one. And then it goes down to here. And then there’s another one: views by revenue, or our impressions versus views. I’m not a particular fan of scatterplot charts. I must admit, I prefer bar charts. They’re dead easy to look at and understand. Impressions to click-through rates. So this, for example, means that from this data, every time this gets shown in the search results, it gets clicked on nearly, well, over 12%, which is extremely high. So that is obviously a very good thumbnail for that video, or a good title. So it’s good to look at these stats like this and then try and work out what you need to understand from there, having it all in a visual way. And you can do this with your personal bank statements, whatever you want. Bear in mind that anything you upload to Chat GPT, although obviously they say that it’s all private and everything else, they could read that data. So if you don’t want anything read, don’t upload it. That’s my advice. But that’s just a quick example of what you can do. And we could ask for those charts. In fact, I will do this. Could you separate the charts into their own individual images, please? Because sometimes when they’re all in one big group like that, it can be a little bit confusing. I can copy the image address for that file, and then if I put it here, we’re able to download the image. And if I just open that up for you now, just grab it and pull it over. There you go. There is an image. So you could use that. We can, of course, save that as a PDF now if we want to as well. And I also think that the code interpreter could do that for us if I asked it to. So I could probably just say, Please turn that into a PDF, and then I can download it straight from there. Or I can download it as an image and do it myself on my computer, whichever And there we are. It has now put all of those charts into their own individual images. We can see them a bit clearer within Chat GPT as well. But it’s a really useful tool within Code Interpreter for you to be able to analyse your data. And don’t forget, we have tonnes of other prompts over here: content analysis, expense tracking, and invoice data. These are all examples of small business owners who might want to use some of these prompts to look at their data, maybe from their Stripe account, PayPal account, or whatever, to get some really good, useful information. So that’s it for Code Interpreter. Feel free to play around with all of the different prompts that we’ve included there. You can also do lots of good things with PDFs. And if you’ve got any questions, then jump into the community, and I’d be more than happy to help.