Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!

Artwork That Never Goes Out of Style

PaperPiAI is a Raspberry Pi-based digital frame that uses Stable Diffusion and OnnxStream to generate a never-ending variety of artwork.

Nick Bild
16 days agoMachine Learning & AI
PaperPiAI uses generative AI to create new artwork (📷: dylski)

Perhaps the most exciting thing about today’s artificial intelligence (AI) tools is not their impressive capabilities, but rather how accessible they have become. Not all that long ago, installing and using these tools was something of an art. Highly specialized hardware was required, along with a slew of software libraries, each of which at a specific version number that likely conflicted with other software already installed on your machine. And chances are that a number of scripts would need to be edited by someone intimately familiar with the framework that was used to build the tool before any magic could happen.

What a pain! This kept the majority of people that just wanted to build something cool with AI — but not get a graduate degree in the field — out of the game for the longest time. Now that many of those details have been hidden, developers are free to unleash their creativity. GitHub user dylski recently built a project called PaperPiAI that demonstrates just how simple it can be to make something really interesting with AI. No specialized hardware or struggling with endless chains of dependencies required.

PaperPiAI is a digital frame that uses generative AI to create and display a never-ending variety of “paintings” of flowers. The generative algorithms run directly on a Raspberry Pi Zero 2, which means that no internet connection or subscription service is needed to power the digital frame. The only other required component is an Inky Impressions 7.3-inch 7-color E Ink display, which keeps both power consumption and hardware costs low.

Underneath the hood, PaperPiAI uses the popular Stable Diffusion text-to-image generator. Typically, this algorithm requires a much more powerful system than the Raspberry Pi Zero 2 for operation, but by using OnnxStream (which we covered here and here), it was able to run even within the hardware constraints of this board.

The two main functions — generating a new image and displaying it — take just a few dozen lines of Python code each. It takes about 30 minutes to generate a new image, and another 30 seconds to refresh the screen, but that is just fine for a digital frame. Even at that speed, it could change the picture more often than most people would want it to.

At this time, the image generation script relies on a set of hardcoded values for types of flowers and art styles to prompt Stable Diffusion with, which limits the variety of the outputs to some extent. dylski did mention wanting to use a large language model (LLM) to automate the process of generating these prompts (and increase the variety), but so far was not able to find an LLM that could run on the Raspberry Pi. dylski — you might want to take a look at llamafile. One of the smaller models might be just what you need to finish this build.

Nick Bild
R&D, creativity, and building the next big thing you never knew you wanted are my specialties.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles