I had ChatGPT build me a free PDF editor because I didn't trust it to change my files - it worked!
Summary
David Gewirtz utilized ChatGPT to develop a deterministic Python script for removing yellow backgrounds from PDF sheet music, addressing a need for his wife to print choir booklets on 8.5-by-11-inch paper. Initial attempts with Photoshop proved too cumbersome due to varying image settings. Direct PDF processing by ChatGPT, despite using a ChatGPT Plus account, yielded "non-deterministic" results, subtly altering content and raising concerns about musical accuracy. Recognizing Python's capabilities from his Harvard programming certification, Gewirtz prompted ChatGPT to generate a command-line script. This script successfully processes JPEGs or multi-page PDFs, converting non-gray or black pixels to white while preserving slightly tinted grays. The resulting `decolor_pdf.py` tool, available on GitHub, provided a reliable, deterministic solution, demonstrating how non-deterministic AI can be used to create precise algorithmic programs.
Key takeaway
For software engineers or developers needing precise, repeatable digital tools without extensive manual coding, consider using non-deterministic AI like ChatGPT to generate deterministic scripts. If you're concerned about AI subtly altering sensitive data, direct the AI to build a command-line program that executes a reliable algorithm. This approach allows you to quickly create custom utilities, such as a PDF decoloring tool, ensuring predictable outcomes and saving development time.
Key insights
Non-deterministic AI can effectively generate deterministic programs for precise, repeatable tasks.
Principles
- AI can create reliable algorithmic tools.
- Simple command-line tools suffice for many tasks.
- Refine AI-generated code iteratively.
Method
Prompt an AI to generate a Python script for specific image/PDF transformations, including color removal and multi-page support, then install dependencies and execute.
In practice
- Use AI to write programs for predictable outcomes.
- Build command-line tools for quick, focused solutions.
- Tweak AI-generated scripts with follow-up prompts.
Topics
- ChatGPT
- Python Scripting
- PDF Processing
- Deterministic AI
- Command-line Tools
- AI Code Generation
Code references
Best for: Software Engineer, AI Student, Consultant
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by News and Advice on the World's Latest Innovations | ZDNET.