GitHub - gogsbread/yulegen: GenAI animations in LED Matrix for Holiday

2 min read Original article ↗

Yulegen

🎄 Light up your holidays with GenAI magic! 🌟

Add a festive twist to your Christmas tree with randomly generated GenAI images on a 32x32 LED Matrix. This cheerful display, powered by Raspberry Pi 4, Adafruit RGB Matrix HAT, 32x32 LED Matrix and creatively framed with Lego blocks. Get ready for a bright and merry season! 🎅✨"

Matrix Setup

Hardware

Tutorial has all the instructions to setup LED Matrix with HAT. rpi-rgb-led-matrix provides all the libraries and low level functions.

Setup

Software

  • The display starts with some bootstrapped images--bootstrap-imgs-path(also genAi). However, these images have been prompt engineered to perfection.
  • At defined speed, --genimgs-per-hour, it downloads images from openAi Image generation Apis. I wanted to run a model locally in the Pi, but as of 2023, this is not a good idea.
  • OpenAi api key is injected as environment variable. Can also be provided with --openai-api-key
  • The generated images are convereted and scaled using ImageMagick and double buffered to the matrix for display. I want to add some animation, but didn't happen.
  • All code is in yulegen.cpp. The daemon can run as systemd service starting at defined time in yulegen-start.timer and stopping at yulegen-stop.timer. Frame rate can be controlled with --animation-duration-ms.

Pre-Installation

# for rendering and scaling
apt install libgraphicsmagick++-dev libwebp-dev
# for httplib to handshake tls
apt install libssl-dev

Installation

make
sudo make install

# cleanup
make clean
sudo make uninstall