ChatGPT has revolutionized how we do things. You may have used it by now to help you get over writer’s block, generate social media posts, or even asked it questions to see if it qualifies to be on your Thursday night trivia team.
In this deep dive, I want to discuss the power and capabilities of ChatGPT’s code interpreter, but I want to focus on how you can use it even if you don’t know how to write code. I am going to be avoiding data visualization, as there are a lot of tutorials already available for this topic.
Note: Using ChatGPT’s code interpreter requires the premium subscription, which costs $20 a month. If you haven’t yet, give ChatGPT’s free version a try first.
ChatGPT’s code interpreter is extremely powerful. It will write Python code to try and carry out the instructions you provided. You do not need to know how to write code, let alone understand it. However, knowing how to read through it could be beneficial so that you’ll have an understanding as to how ChatGPT solved the problem.
Example ChatGPT code interpreter interface
Thankfully, Python relatively easy to read as it is. To boot, ChatGPT does a fantastic job with commenting the code. Remember that you can always include in your prompt “when writing code, be sure to include comments like a 5th grader will read it”.
Before diving in, you’re going to want to keep in mind the following 6 points:
Context is your friend. Be sure to give ChatGPT information it needs to know. The more it knows while you’re prompting, the better your result will be. I wrote about how what makes a great prompt a great prompt in Edition 1.
Hallucinations exist. It may look like the ChatGPT knows what it’s talking about, but it may provide you with false information, even with sufficient “supporting evidence”. I discuss what this looks like in Edition 5.
Don’t prompt with sensitive information. Remember that ChatGPT does retain data and the model is trained on anything you prompt unless you opt out. In fact, this is the reason why Samsung banned ChatGPT.
The output likely won’t be completely satisfactory. This is especially true when you first start working with ChatGPT. In fact, you may want to settle for a “bare bones” output and build the remainder yourself.
The code interpreter can read files. This is very powerful because you’re able to use your own data! You are able to upload popular file extensions such as .txt, .pdf, .doc/.docx, .jpg/.jpeg, .png, .mp4, .csv, .json, .xml, .xlsx, .py, .html, and so much more.
It’ll “forget” things (over time). If you walk away for a period of time, the code interpreter will “time out” and you’ll have to start over, which also means you’ll need to re-upload your files.
Banner to show that the code interpreter has timed out.
2 Examples with prompts and outputs
The in-depth examples below are geared towards academia, but they can be applied to just about any other industry. In these 2 examples, I include the prompt(s) I used and showcase the output. You’ll be able to download the relevant files as well.
1. Similarities between text.
Suppose that you have a stack of student-written papers that you need to sort through. Before reading through each one individually, you may want to get a preliminary peek to see if there’s any sort of plagiarism between students.
Using the provided zip file, please use Doc2Vec to determine similarities between the texts. Please provide the output in CSV file as a similarity matrix in alphabetical order. This similarity matrix should be a cosine similarity matrix.
ChatGPT built a machine learning model, which can cue me into papers were the most similar content wise. After setting conditional formatting in Excel, I was able to take a peek at the data:
Excel output for cosine similarity analysis for a set of papers
The cells in red share very similar content, whereas cells in green differ from one another. You’ll notice a red line down the middle - we would expect these to be red since the same paper is being compared against itself.
In this scenario, we see that paper 6 and paper 7 are red. Does this mean they copied one another? Not necessarily - you can’t conclude from this. Having a red cell tells us that we should look further into these papers, as the content is very similar. It’s important that human intervention is needed (no matter what) and conclusions shouldn’t be drawn right away. Verification and validation of the output is necessary whenever working with this kind of technology.
2. Expedite the course content creation process.
Content creation is hard. Creating content for a course is even more difficult and time consuming. If you have an outline of what you want to discuss for a class, you can upload this to ChatGPT and tell it to create a PowerPoint to back your lecture, for example.
I borrowed my meteorology professor’s notes (thanks Dr. DeCaria!), uploaded it to ChatGPT, prompted it to generate a PowerPoint based off of the notes, and then provide me the PowerPoint file with the following prompt:
“Attached are lecture notes about clouds for the introduction to meteorology course. I want you to generate a PowerPoint for each section that can be used to lecture a class on each of the points. You don't need to be super detailed, but it does need to reflect the notes I have uploaded.”
The code interpreter did its magic and wrote out code, but it did stop me along the way to make sure it was doing the job it was supposed to do.
ChatGPT provided me with a 17-slide PowerPoint file, mostly filled with the content from the notes. There is some work that needs to get added in (such as a title slide), but overall it’s fairly solid and can be built upon further:
The lecture notes and associated generated PowerPoint
How else can I use the code interpreter?
There’s lots of other ways you can use the code interpreter:
1. Create QR codes easily.
» “Please create a QR code for the following website: https://www.bytesandbrew.com”
2. Perform semi-basic image manipulation, such as blurring and inverting colors.
» “Please identify the face of the attached image and blur it out.”
3. Read a math equation from an image and have GPT solve it.
» “Please read the math equation from the provided image. Once you do so, repeat it back to me so I know you understand it. Then we’ll solve it.”
4. Convert videos to gifs (I tried this for this edition! Gifs were too large 😢).
» “Please convert the attached video to a gif. Be sure to provide the size of it after converting. We’ll work on scaling it down after you are done.”
5. Edit audio clips to remove filler words and those awkward pauses.
» “Please remove filler words from the following audio clip such as “uh” and “um”, as well as large pauses.”
6. Convert between file formats with specifications.
» “Please convert the attached text file to a Microsoft word file. All header-like lines should be font size 16, all other text should be size 12.”
Does this mean I should buy a subscription for ChatGPT?
Possibly. You’re not going to want to stitch a gown with a stapler. While the code interpreter may be a viable solution, it may not be the right tool to get the job done.
Maybe it’s worth giving it a shot and seeing how it performs. Of course, it’ll take some time, practice, and skill to get the prompting down. Maybe not even using AI to begin with will do the trick. In fact, is AI the best way to solve problems? We’ll talk about that next edition…
By the way, I love hearing from my audience. If you enjoyed this deep dive, please let me know. Simply respond to this email and it’ll appear in my inbox!