Skip to content

A simple python script that generates an image with OpanAI Dall-E, then converts it to a 3-color image and draws it on a Waveshare e-ink display.

License

Notifications You must be signed in to change notification settings

laszloszurok/rpi-dalle-waveshare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A simple python script that generates an image with OpanAI Dall-E, then converts it to a 3-color image and draws it on a Waveshare e-ink display.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages