Observe ZDNET: Add us as a most popular supply on Google.
ZDNET’s key takeaways
- Yellow sheet music can confuse playback apps.
- A command-line Python script solved the PDF downside.
- Typically AI is greatest used to jot down the software.
Just lately, my spouse, Denise, began singing along with her church’s choir. She has a beautiful singing voice. She wanted to apply all the brand new songs. The songs got here in booklets, in regards to the dimension of a commerce paperback, printed on yellow paper. She wished to scan these booklets into her laptop as a PDF, take away the colour, and reprint them bigger, on 8.5-by-11-inch paper so she would not should put on her studying glasses to see them.
So one afternoon she got here to me. She requested how she may take away the yellow background, however protect the music itself, in order that she may print it out with out losing an enormous quantity of shade printer ink. If she printed it out in black and white, she’d nonetheless be utilizing a whole lot of ink to print out a grey background, which might be even tougher to see.
She was additionally planning to feed the music into PlayScore 2, an app that performs the sheet music in an effort to sing alongside to it. She was involved the software program won’t just like the background shade.
I initially steered eradicating the yellow background in Photoshop, however the process turned out to be too fiddly. Every picture wanted barely completely different slider settings. It was simply too annoying and time consuming to do it that manner.
So, I steered she use ChatGPT. She has a ChatGPT Plus account, so this appeared like a good possibility.
Deterministic vs. non-deterministic
I did some checks, utilizing prompts like:
Give me again a PDF I can obtain the place the yellow background has been eliminated and changed with white.
You probably did it accurately, however sadly, the textual content high quality could be very low decision. Are you able to regenerate it in full decision, please?
These checks labored, however ChatGPT subtly altered the ensuing PDFs. My spouse was involved that ChatGPT would possibly change the notes the phrases or another side of the unique music. She did not wish to sight learn and apply it fallacious.
ChatGPT and different AIs are “non-deterministic.” Webster’s defines determinism as, “occurrences in nature, or social or psychological phenomena [that] are causally decided by previous occasions or pure legal guidelines.” In different phrases, the enter at all times predicts the output.
Algorithmic programming, not like AI, is deeply deterministic. Granted, packages can go off the deep finish, however they accomplish that in a manner that may finally be predicted from the precise association of code and variables.
AIs are non-deterministic. Which means you could possibly feed in the very same enter three or 4 instances, and get three or 4 completely different outcomes again. It is type of like speaking to a plumber or an electrician. AIs base their outcomes on a fancy collection of chance calculations, so the outcomes can change with every go.
Denise has skilled this in her interactions with ChatGPT. She most positively did not wish to give ChatGPT her music and get again one thing the place ChatGPT took liberties with the masters.
She wished a software to take away background shade that was strictly deterministic.
Python can do this
For my last program in my Harvard Python programming certification, I wrote an interactive picture administration software that was capable of do particular person Photoshop-like picture transformations, and batch them collectively in sequences. So I knew that Python has the libraries to perform what Denise wished.
I, then again, did not have the time to jot down a Python program to try this. It was a really busy week. I had a protracted backlog of work-related tasks I wanted to energy although.
However ChatGPT has on a regular basis on the earth. That is the place issues get cool. You should use a non-deterministic software like ChatGPT to generate a deterministic program, like a Python decoloring software. If you wish to learn a very attention-grabbing article on AI determinism vs. non-determinism, learn this by former ZDNETer Jason Perlow.
In any case, I made a decision to ask ChatGPT to jot down a Python script that will do the colour elimination. To create the script, I gave it this immediate, after which went into the kitchen to assist my spouse put together dinner.
Write a python script that takes in a jpeg and units any pixels that aren’t grey or black to white, saving it again out as name-decolor.jpg the place identify is the file identify. Permit barely tinted grays in order that black textual content on a coloured background will render correctly as black textual content. Are you able to do the identical factor if a PDF is introduced? It additionally must work if the PDF is a number of pages.
By the point dinner was achieved, so was ChatGPT. The primary model of the script had a number of points as a result of I wanted to put in a Python library. However after that, it simply ran.
It really works very merely. You execute this system decolor_pdf.py from the command line, feeding it a single PDF file. It outputs a brand new PDF file with the background shade eliminated.
% python decolor_pdf.py enter.pdf
Does it work?
Yeah, it does. If you wish to obtain a replica for your self, it is on my GitHub repo. My spouse was involved about me utilizing screenshots on this article from the copyrighted church hymnals, so visited the New York Public Library’s web site and grabbed a public area tune to display.
It is a tune by jazz nice Fat Waller, who additionally wrote a number of musicals. It is a bit of a racy tune, utilizing horse racing metaphors to explain altering lovers. It was co-written with Andy Razaf, recognized for writing the lyrics to songs as “Ain’t Misbehavin'” and “Honeysuckle Rose”.
Useful classes
So there are a number of useful takeaways from this expertise.
- If you would like the AI’s assist, you do not at all times have to depend on non-deterministic processing. Typically, you’ll be able to simply ask for it to jot down you a program that works based mostly on a dependable algorithm.
- You additionally do not have to spend so much of time on creating a glance or UI. Typically making a easy command-line software will get the job achieved.
- Do not be afraid to refine your spec with the AI. Check out what it creates after which ask for tweaks and fixes.
- Python can do rather a lot. There are lots of, many libraries so should you’re undecided what you wish to use, construct it in Python.
So there you go. In case you want a fast answer to one thing, strive asking ChatGPT to jot down it for you. Labored for me and I used to be capable of give my spouse a workable software and assist de-chickelate a rotisserie hen on the identical time.
Have you ever ever prevented utilizing AI instantly since you had been apprehensive it would subtly change the unique file? Tell us within the feedback beneath.
You’ll be able to observe my day-to-day undertaking updates on social media. You should definitely subscribe to my weekly replace publication, and observe me on Twitter/X at @DavidGewirtz, on Fb at Fb.com/DavidGewirtz, on Instagram at Instagram.com/DavidGewirtz, on Bluesky at @DavidGewirtz.com, and on YouTube at YouTube.com/DavidGewirtzTV.





