This is a quick and easy way to get poetry camera running on a pi. I haven't been able to get the printer to work on a first time install yet so I have left it out of the following guide
In the Termial
sudo raspi.config
In Interface options turn serial port on and serial console off
In Adavace options turn Glamor on
Install modules needed for poetry camera
sudo apt-get updatesudo apt-get install git cups build-essential libcups2-dev libcupsimage2-dev python3-serial python3-pil python3-unidecode
open your main.py and set you gpio for the wires connected to the header of the pi
#instantiate buttons
shutter_button = Button(16) # REPLACE WTH YOUR OWN BUTTON PINS
power_button = Button(26, hold_time = 2) #REPLACE WITH YOUR OWN BUTTON PINS
led = LED(20)
In it's current version there is a root file directory call in main.py so you have to add a variable to handle this for now.
open main.py and add the following line of code
#get path for poetry camera folder
home_directory = os.path.expanduser('~') + "/poetry-camera-rpi/"
then change this
metadata = picam2.capture_file('/home/carolynz/CamTest/images/image.jpg')
to this
metadata = picam2.capture_file(home_directory + "image.jpg")
and this
"image": open("/home/carolynz/CamTest/images/image.jpg", "rb"),
to this
"image": open(home_directory + "image.jpg", "rb")
Then run the script in the terminal
python main.py
This is a quick and easy way to get poetry camera running on a pi. I haven't been able to get the printer to work on a first time install yet so I have left it out of the following guide
In the Termial
sudo raspi.config
In Interface options turn serial port on and serial console off In Adavace options turn Glamor onInstall modules needed for poetry camera
sudo apt-get update
sudo apt-get install git cups build-essential libcups2-dev libcupsimage2-dev python3-serial python3-pil python3-unidecode
Install Replicate/DotEnv/OpenAI
sudo pip install replicate python-dotenv openai
Install Poetry Camera
git clone poetry-camera-rpi
Open the poetry camera rpi folder and create a .env File(If in folder Click on view > Show Hidden Files)
Open .env file to store your 2 api keys needed for poetry camera
Create an OpenAI key at https://replicate.com/account/api-tokens
OPENAI_API_KEY = 'Your Key'
Create an Replicate key at https://replicate.com/account/api-tokens
REPLICATE_API_TOKEN = 'Your Key'
Save your .env file
open your main.py and set you gpio for the wires connected to the header of the pi![a-and-b-physical-pin-numbers](https://github.com/carolynz/poetry-camera-rpi/assets/153971142/6bc3cfe9-175f-4da5-a42e-97eca9cd510c)
In it's current version there is a root file directory call in main.py so you have to add a variable to handle this for now.
open main.py and add the following line of code
then change this
metadata = picam2.capture_file('/home/carolynz/CamTest/images/image.jpg')
to this
metadata = picam2.capture_file(home_directory + "image.jpg")
and this
"image": open("/home/carolynz/CamTest/images/image.jpg", "rb"),
to this
"image": open(home_directory + "image.jpg", "rb")
Then run the script in the terminal
python main.py