GenPiCam - a RaspberryPi based camera that re-imagines the world with GenAI.
Read the blog for more details
Create a virtual python environment to keep dependencies separate. The venv module is the preferred way to create and manage virtual environments.
python3 -m venv env
Before you can start installing or using packages in your virtual environment you’ll need to activate it.
source env/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
This code is definitely a rough, work-in-progress. You'll need to tinker with things to get it to work locally. Consider this code "inspiration" and not a complete solution.
- Setup a
discord_config.py
file with with a Discord token which has enough scope to interact with messages (you can copy discord_config_EXAMPLE.py) - It is assumed you have a Discord channel setup, and have added a Midjourney bot (with appropriate subscription). You'll need to add your Discord bot to the same channel so the token has sufficient scope.
- The Discord web page should be open - as GenPiCam will literally be controlling the mouse and keyboard to interact with Midjourney bot.
- The describe mode requires some very ugly code to interact with the file browser icon (literally the button you press to open the file selection dialog). Depending on your screen size, you may need to adjust the location of the browse file mouse pointer location in midjourney.py
Basic usage; run interactive commands against Discord Midjourney bot to automatically chain actions. Does not require a RaspberryPi.
python generative_camera.py --auto
RaspberryPi usage; will dynamically import Raspberry Pi GPIO library
export DISPLAY=:0
python generative_camera.py --enablePi --auto
If you get an error import Raspberry Pi GPIO library import RPi.GPIO
try the following package updates
sudo apt-get install python3-dev python3-rpi.gpio
pip install RPi.GPIO
- Discord Bot to Download Midjourney Images Automatically by Michael King - provided inspiration for using Python to download images from Midjourney
- Midjourney - Midjourney command syntax for bot channels
- discord.py - Python API wrapper for Discord.