ChatGPT and programming: Incredible. Terrifying. I love it.
I feel like a farm worker in the early 1900s that has seen a tractor for the first time.
The future is here. I’ve seen it. I’ve used it. It has blown my mind.
ChatGPT has been released in free research preview and it is incredible.
While ChatGPT can do many different things, it’s the programming side that I’m particularly interested in.
You can ask it — in plain english — to generate code for you by describing what you want the code to do. Recently I’ve been using MicroPython and Python a lot, so focussed on that.
Here’s some examples:
Prompt:
“in python, open an image then draw a red alpha’d filed rectangle around any human faces. Show the rectangle properties aligned under the rectangle. Make the text red and bold”
Execution: (on AI faces)
Prompt:
“in python, open a video, then draw a red alpha’d filed rectangle around any human faces in each frame. Show the rectangle properties aligned under the rectangle. Make the text red and bold.”
Execution:
More in that series here: https://twitter.com/yezzer/status/1599031876416520192
Prompt:
“in python, write a web service that will return a live feed of my webcam”
Execution:
Prompt: “in python, open an image, and place a dog loaded from https://dog.ceo/api/breeds/image/random/ on top of the faces”
+ “each face should show a different dog”
+ “the dogs should be RGB not greyscale”
+ asking it to fix some errors (it fixes it’s own code too!)
Execution:
Prompt:
“write me python to open an image and draw a grid on top. the grid spacing should be 12 pixels”
Execution:
Followup prompt:
“As I move the mouse over a grid square it should highlight the square in red”
Execution:
This is usable right now. While it can’t — yet — write larger programs, it’s absolutely a quick way to write parts that can be taken and expanded on, and it’s a super easy way to test concepts.
Exciting times.