Recently I was curious and tested some simple questions with the new GPT 3.0 Assistant trained by OpenAI; I also tried to by using it with a small programming project using Python. Which is known as the most convenient language in many people’s eyes.
The project used a simple 16×2 character display to display statistics about the server hosting the site you are reading this on, which is run locally on a Raspberry Pi. I wanted to see live status updates on my website from the comfort of my desk without logging into the Pi via SSH and pulling the data on the command line. So I found a starting point, a library made originally by The Raspberry Pi Guy with many simple demos on using the character display to display information.
One problem is that I am not experienced in using Python and have only used it in minor tasks. So I was curious to see if I could use the AI model to help me create a python script. And I was surprised by the end result.
First, I gripped a built-in script with the demos that I had downloaded to the Raspberry Pi, hooked up a 16×2 display I had lying around, and only had one minor bug before I could get the script properly running. The original python script was built for a different version of python and used a different version. It used:
!/usr/bin/env python
Instead of:
!/usr/bin/env python3
Which just states where the python library is located; in my case, mine was called Python3.
Once I confirmed that the display worked, I started editing one of the files as a starting point for my script; the essential functions I wanted it to display are:
- CPU temperature
- Check if the correct system tasks are running
- Ping the internet for a connection
- Ping the website domain to see if the website is running
I started with a demo script called netmonit.py, which pinged the local internet router and pinged google. Then displayed them on the screen one by one, this demo being the closest I chose it. Then I found a script on the raspberry pi forum, which grabbed the CPU temperature and stored it to a variable, (it also printed it out to the console, but I didn’t need that, so I deleted that part.) I then mashed those two together to produce a script that surprisingly worked. But it didn’t all work out of the box.
This is where ChatGPT came in handy; the assistant was able
1: Find errors, correct them, and give me back the corrected code
2: It told me what I had done wrong and told me what to do to fix it.
3: I could even remember what code I gave it before and use that information to help me in the following answer. (This only was useful for a minor part but was noticed)
Here’s some example of what it fixed for me (please keep in mind I’m a novice in Python and programming, so these issues are primarily googlable:)
I even used it to solve my errors for me:
I am honestly amazed by some of the technology. Using the power of this AI and my knowledge of basic programming, I could build a script that did all of the tasks I had before listed and display them to my display. And this was the result, a working screen display for my desk:
Conclusion:
Some say this will replace humans in some jobs, and I can see why they say that. I don’t see it as something that can completely replace the position. This is far from perfect or even close. I even had issues with some of the code the AI gave me, like some of it is outdated or the code was mashed from different sources. I see it as AI will become a super helpful tool, especially in programming, but it will only be that for now. The AI works in the simplest sense, grabbing datasets from books and the internet. But I think ChatGPT says it best:
To train me, OpenAI used a process called unsupervised learning, in which the AI system is not given explicit labels or examples to learn from, but is instead left to discover patterns and relationships in the data on its own. In my case, the data consisted of a large dataset of text from a wide range of sources, including books, articles, and websites.
-ChatGPT, or “Assistant”
I do not have access to any additional data or information beyond what was used to train me, and I do not have the ability to browse the web or access new information. I can only provide answers and generate text based on my training and the information that I have been provided.
ChatGPT, or “Assistant”
Learning, though, is where it excels, for most popular languages would benefit students in learning programming. A tool instead of a replacement in the programming space. This video by Joshua Morony really demonstrates how well it works and has an excellent summary, I would recommend watching it: