Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 1.63 KB

README.md

File metadata and controls

61 lines (42 loc) · 1.63 KB

Intro

This script should be run on a Raspberry Pi with a Waveshare e-ink display attached to it.

The contents of the waveshare_epd directory were copied from here: https://github.com/waveshareteam/e-Paper/tree/master/RaspberryPi_JetsonNano/python/lib/waveshare_epd

The display model that I'm using in this script has a 7.5 inch diameter and a 640x384 resolution. To initialize and use the display I had to import the code from waveshare_epd/epd7in5bc. Edit main.py with the correct import and resolution settings if you have a different model.

Usage

Clone the repo

git clone https://github.com/laszloszurok/rpi-dalle-waveshare.git
cd rpi-dalle-waveshare

Create a virtual environment

python -m venv venv

Activate the venv

source venv/bin/activate

Install requirements

pip install -r requirements.txt

Set the OPENAI_API_KEY environment variable

export OPENAI_API_KEY="replce-with-a-valid-api-key"

Run the script

python main.py

You might get a warning similar to this:

.../venv/lib/python3.11/site-packages/gpiozero/devices.py:300: PinFactoryFallback: Falling back from lgpio: module 'lgpio' has no attribute 'SET_BIAS_DISABLE'
  warnings.warn(

Here is a related gpiozero github issue: gpiozero/gpiozero#1038. TLDR: The warning should not cause problems and can be ignored.

Example result

The original image generated by Dall-E: image of an ink puddle, that has the shape of a cat

The final image that will be drawn on the e-ink display: image of an ink puddle, that has the shape of a cat