This article describes how non-programmers can use my Python CLI AI program at:
to generate a collection of art pieces for monitization as NFTs (Non-Fungible Tokens) on Marketplaces with digital contracts.
NFTs are stored (like GitHub) in blockchains of cryptographically defined addresses. The chain of addresses provide a secure and transparent way to verify authenticity and ownership.
Because this Python program assembles many Python coding tricks and API calls together, in one workflow, it can be quickly and securely be adapted to do a full suite of tasks.
Thus, to some this may seem like a “bloated swiss army knife” monolith. However, after team review, utility functions here will be moved to separate Python module files. But they are together here now to make it easier to understand and modify.
“The printing press democratised knowledge,
the camera democratised images,
and AI is democratizing creativity itself.” – Kevin Kelly
Currently, this program has both local programming and Generative AI (GenAI) API calls to create (from text prompt) a PNG image file that can be printed and possibly sold as NFT art.
This workflow can be extended to other output formats: text, audio/music, video, 3D objects for printing, synthetic data, code.
Criteria for evaluating foundation LLMs:
Regulations around AI:
This effort is to see how the different ways of creating horizontal and vertical lines of rectangular boxes filled with primary colors compare with the intuitive beauty of works manually created by Mondrian himself. Some call the art style “pure abstract Neoplasticism”.
I came to generate my fake art in Piet Mondrian style because it seemed easy to create his style in computer code: rectangular blocs with sharp corners and filled with primary colors.
While impressionists were painting soft landscapes, Piet Mondrian started a new movement of abstract art with his “21” in 1921. It presents as logical and simple for people who liked things orderly.
When I was learning websites in the late 1980’s, I wrote a Java program that created random Mondrian-styled images. Recently, I rewrote it in Python, which generated images like this:
When GenerativeAI burst on the scene in 2022, I thought it would be interesting to write prompts to see what text-to-image generators would do. Here is one artpiece generated by OpenAI’s DALL-E:
I was astonished of the “liberties” generator took with my prompt text. The image generated didn’t have straight lines like my programmatic code would generate.
Here is an example of how AI’s LLM “fills in the gaps” of what my prompt text did not specify.
It’s ability to “hallucinate” is a feature, not a bug.
If you want the same result every time, write a procedural program like your grandpa did.
That artpiece on my wall is a reminder thatAI generation is not “deterministic”, meaning that every time I run the program with the same prompt, a different image is generated.
So I had that first image framed and hanging among on my wall as the basis for comparing others generated. I used a frame similar to another real Mondrian paining:
What would other text-to-image generators do with the same prompt?
When Qwen became available Feb 2025, I used it to generate this:
The above broke the “rules” of Mondrian with its broken and faded lines. Colors are not confined between lines.
Lookign at it reminds me that AI does not natively respect rules.
The above provides a sequence of the program’s workflow. It is a snapshot of a future video created from this PowerPoint.
VIDEO: How de-aging in movies got so good on movies such as Tom Hanks & Robin Wright in >Here (2024).
#1 and #2 in my workflow description (in yellow) is to manually generate an API key for each service and store them securely for authenticated access by the program code.
When I don’t specify a specific api service, the program rotates through them one at a time.
The CLI call is #3 in my workflow description.
Get API key for NVIDIA: https://build.ngc.nvidia.com/explore/
I added a parameter to specify the number of images to generate with each CLI command call. I prefer to make a separate call for each image generation rather than specifying it in the request to the API. This is so that I can control the file name for each image generated.
Within a Jupyter enviornment,
https://www.yvfoodhub.com/
The program begins with capturing time stamps at the earliest possible moment.
Several different ways and modules have been used for time reporting.
Due to deprecations of datetime.utcnow() since version 3.12, we now use datetime.now(UTC) to obtain a datetime object that is “aware” of political time zones rather than “naive” ones that do not. See https://docs.python.org/3/library/datetime.html?timetuple=#datetime.datetime.utcnow
To ensure consistency in all logs from machines throughout the world, we store time stamps in UTC and in 24-hour clock time. Python, PostgreSQL, FastAPI, and others use the precision of
ISO 8601 YYYY-MM-DD HH:MM:SS.ssssss+00:00 standard format
such as: 2026-02-10 12:24:40.089415+00:00
(MySQL omits the precision). Others add “Z” to indicate the UTC time zone, which is NOT adjusted for DST (Daylight Savings Time). Others add a time zone offset, such as the negative “-07:00” indicates a time zone West of UTC/GMT.
Presentation to users is in each user’s local time zone and in AM/PM format:
coverted from UTC ed on the local time zone obtained from operating system settings, such as:
2026-02-10 12:24:40.089415 PM MST -0700
Pydantic is a Python module for performing configuration management, data validation, serialization, and deserialization. It is primarily a data parser which validates data.
Pydantic helps with debugging.
Instead of unpacking the dictionary with **kwargs, Pydantic v2 creates model instances from dictionaries (like JSON objects) by using the model_validate method, which provides a more explicit and type-safe way to parse data into Pydantic models.
https://www.prefect.io/blog/what-is-pydantic-validating-data-in-python Prefect: A workflow management system that uses Pydantic for configuration and data validation.
Typer: A library for building CLI applications that uses Pydantic for argument parsing and validation.
FastAPI is a popular example of a production Python codebase that extensively uses Pydantic. in its request and response models.
https://www.netguru.com/blog/data-validation-pydantic
A Pydantic model defines the structure and types of data expected in the request body.
Pydantic references models to automatically validate incoming data, convert it to Python objects, and generate API documentation.
CAUTION: Unencrypted secrets in .env files not only exposes them to anyone who has access to your laptop, you may lose them if not backed up properly. Coding should reference them in the User’s Home folder where GitHub usually doesn’t look.
However, .env files still contain plain text rather than encrypted cyphertext.
CAUTION: Unencrypted secrets in .env files not only exposes them to anyone who has access to your laptop, you may lose them if not backed up properly.
So the script automates backup before making use of the files. On macOS, the Time Machine app is invoked. Alternately, a zip file can be produced for a specified folder path.
Some APIs were written to obtain its API Key from an OS-level variable.
The workflow includes an analysis of the prompt text for Negative, Positive, and Neutral words based on the “VADER” rule-based database of English words downloaded locally. The “VADER” database is specifically trained for sentiment analysis in natural language.
Dashboards
Amazon Comprehend also provides Named Entity Recognition and other NLP capabilities. TODO: detect use of inappropriate language and flag use of keywords that indicate exposure of proprietary and PII (Personally Identifiable Information) that should remain private. Amazon Macie discovers sensitive data (projects, product names, people, organizations, locations). Some call this feature “Leak Detection”.
Amazon Bedrock provides such safeguards, to include flagging of prompt injection attacks.
AWS SageMaker Debugger analyzes model training in real-time and offline, identifying issues and providing prediction insights.
AWS SageMaker Clarify detects bias and explains model predictions, ensuring fairness.
See https://bomonike.github.io/prompt-engineering/
The program uses the DSPy Python library (based on PyTorch) to fine-tune prompt text using LLMs.
The program iterates though a list of LLMs:
Additionally, the program iterates through each LLM a specified number of times. This enables an entire collection to be generated in a single run.
Additional LLM APIs:
The 2025 movie “Here” on Netflix uses AI to dynamically de-age and age faces.
INFO: Several characters, including Carrie Fisher was digitally enhanced using AI.
https://www.microsoft.com/en-us/research/blog/introducing-muse-our-first-generative-ai-model-designed-for-gameplay-ideation/
The program currently outputs “lossless” .png format image files.
TODO: It can also create files that are smaller by outputting “lossy” format image files in (jpeg, webp, etc.).
TODO: Add creation of video (.mp4) format files created by Runway.ai, Suna, etc. https://www.youtube.com/watch?v=oENgwLgnK7Q Groq from ByteDance China initially generates 288x512 videos, but aims for 480x864 and eventually 720x1280.
TODO: Add creation of music (.mp4) created by Suno
Adobe Firefly Video is an AI-powered tool that generates and edits video from text prompts. Unlike other AI video generators, Firefly is IP-safe and built for commercial use.
Traditionally, the effectivenss of AI is measured by “Accuracy”.
When art can be generated en masse, a measure of taste or “desirability” is helpful to determine whether each particular item should be hoisted to certain audiences.
https://bigthink.com/mini-philosophy/the-hidden-mathematics-behind-why-you-find-things-beautiful/ Formalism holds that we can account for aesthetic judgments in non-aesthetic terms. Maybe we find a song beautiful because of its tertian harmonies, or we like a certain photo because the angular lines converge on a point.
Mozart used the Golden Ratio in The Magic Flute, as did Debussy and Bartók. Le Corbusier used Fibonacci numbers as a kind of blueprint for building.
Amazon Augmented AI (A2I) inserts human review through Mechanical Turk.
Amazon Personalize for A/B testing segmentation. explainability
TODO: Use Cursor / Windsurf to write unit tests & fix bugs.
https://www.loom.com/share/f2ea32dedb7d4e81b55821dfd33f760a HeyMint Launchpad ERC-721 Walkthrough
BTW https://www.youtube.com/watch?v=BMAemNpHFP4 Format Watermark using LibreOffice from docxtpl import DocXTemplate
Encryption also involves the creation and storage of keys used to encrypt and decrypt files.
The program can generate an symmetric key or a pair of asymmetric private and public keys.
On macOS machines, the program stores keys in Keychain app because it authenticates users.
To monitize, a crypto wallet is needed. There are several of them.
Foundry: The Next-Gen Ethereum Development Framework
Instead of Hardhat or Brownie which uses Solidity:
https://www.sothebys.com/en/articles/generative-art-a-quintessentially-modern-art-form
NEAR protocol
https://github.com/PacktPublishing/Hands-On-Blockchain-for-Python-Developers–2nd-Editionx` https://learning.oreilly.com/library/view/hands-on-blockchain-for/9781805121367/ Hands-On Blockchain for Python Developers - Second Edition https://www.packtpub.com/big-data-and-business-intelligence/hands-blockchain-python-developers By Arjuna Sky Kok in Jakarta, Indonesia
Chapter 1: Introduction To Blockchain Programming Chapter 2: Smart Contract Fundamentals Chapter 3: Using Vyper To Implement A Smart Contract
Part 2: Web3 And Ape Framework Chapter 4: Using Web3.Py To Interact With Smart Contracts Chapter 5: Ape Framework Chapter 6: Building A Practical Decentralized Application
Part 3: Graphical User Interface Applications Chapter 7: Front-End Decentralized Application Chapter 8: Cryptocurrency Wallet
Part 4: Related Technologies Chapter 9: InterPlanetary: A Brave New File System Chapter 10: Implementing A Decentralized Application Using IPFS Chapter 11: Exploring Layer 2
Part 5: Cryptocurrency And NFT Chapter 12: Creating Tokens On Ethereum Chapter 13: How To Create An NFT
Part 6: Writing Complex Smart Contracts Chapter 14: Writing NFT Marketplace Smart Contracts Chapter 15: Writing A Lending Vault Smart Contract Chapter 16: Decentralized Exchange
Part 7: Building A Full-Stack Web3 Application Chapter 17: Token-Gated Applications
Niftykit Bueno Manifold.xyz
NFT on OpenSea
EVM-based chains
Non-EVM based chains such as Solana.
pre-reveal image
TODO: Use Replicate to generate thumbnails
To physically hold files (permanently and cheaply), many blockchain enthusiasts make use of the IPFS (InterPlanetary File System) protocol to a decentralized Filecoin Network.
with smart contracts to be deployed on multiple chains like FVM, Optimism, Polygon, Solana, etc.
Files (and their metadata) would be referenced by a CID, which is a SHA256 hash of the file’s contents plus https to a gateway. which provides:
* token gated access on a public network.
A temporary gateway can be setup on any laptop.
There are several organizations that provide a dedicated gateway serving requests
Gateways built on IPFS and Filecoin:
Free service NFT.storage (on github) was decommissioned on June 30, 2024 (VIDEO by Reece Hunter)
Lighthouse offers a free 1GB starter plan and unique “pay-once and store-forever” pricing starting at $20 for 5GB storage and 10GB bandwidth. Their UI.
Pinata.cloud offers flexible plans and powerful, easy-to-use tools for managing data on IPFS. Use code NFTSTORAGE50 at checkout to enjoy 50% off your first month. Sign up today. Python 360
web3.py Engicode
NFT Token Checker, a tool for block explorers, marketplaces, and wallets to show verification that NFT collections, tokens, and CIDs are preserved by NFT.Storage.
QR codes typically send a URL to mobile devices though their camera.
Discord is a free chat app that doesn’t charge money.
Emailing to a Gmail account is free.
TODO: Send to any email https://www.emaildev.com/
Those like Zapier, and Microsoft Teams.
TODO: Send to Jira.com, monday.com
TODO: Send to TODOIST https://developer.todoist.com/sync/v8/
TODO: Send to IFTTT
TODO: Send to RCS (Rich Com Svs) used by iPhones & Android See https://developers.melroselabs.com/docs/send-rcs-with-maap-using-python
MongoDB Atlas is used as a cloud-based RAG to augment LLMs.
Traditionally, MongoDB provides a free dev tier for document databases. Its uses if GUID as index enable it to absorb much larger volumes of data, faster, than typical database computers.
In 2025 Mongo acquired Embeddings Reranker Voyage AI.
https://info.stardog.com/stop-hallucinating-improving-aisafety-safteyrag-watch-0?submissionGuid=5d68dd51-092e-418e-81b5-f99d46ad4b3c
dashboard and, more importantly, alerts
Before he died in 1944, Mondrian was working on two paintings simultaneusly: This one he called “Boogy Woogie” (after the jazz song).
This above fittingly hung in New York’s Museum of Modern Art.
The work is shown above in full screen so you can see that the colorful lines were made by applying colored tape. Mondrian didn’t know about then until he arrived in New York City from the Netherlands. Piet Mondrian was born in Amersfort, Netherlands 1872.
To recreate the painting, a robot would be needed to apply the colored tape to the canvas.
On the Intel Gaudi cloud, run the Stable Diffusion model v2.1 to create images based on your text prompt. Use Intel Gaudi software Model References and Hugging Face Optimum Habana library running Gaudi PyTorch:
Log into the Intel Tiber AI Cloud.
https://console.cloud.intel.com/
Launch Jupyter notebook which uses the Intel Model Reference GitHub repository:
https://github.com/intel?
Consider viewing related documents.
See the https://console.cloud.intel.com/docs/tutorials/jupyter_learning.html#jupyter-learning Jupyter Guide
Follow the instructions and examples in the Jupyter notebook.
Other articles about tools to generate art:
Anthropic
Cursiv
https://promptmate.io/generative-ai-for-beginners/
https://youtube.com/shorts/QUX-ChuDEHA?si=dZFccVITZHKvX2Cx leep day century year
https://www.youtube.com/watch?v=U1_0swrCiAY Supabase pgvector db fo AI agents open wource
https://coinsbench.com/
https://www.youtube.com/watch?v=zYpBHc8px_U&pp=ygUbUXVhcnRldCBmb3IgdGhlIEVuZCBvZiBUaW1l Messiaen: Quartet for the End of Time
https://www.moontechnolabs.com/blog/nft-marketplace-development/
Go Meta with Oli Sharpe: https://www.youtube.com/watch?v=By00CdIBqmo Why full, human level AGI won’t happen anytime soon
https://www.youtube.com/watch?v=TC9Op30QghI sis from the IMF
https://ai21.com/