DevMiser / AI_Art_Frame

The DALL-E 3 Voice-Controlled AI E-Ink Art Frame
MIT License
14 stars 0 forks source link

RPi GPIO #2

Open EA914 opened 5 months ago

EA914 commented 5 months ago

For the LED part of the code do I need to import and install RPi.GPIO? It's not in your instructions or import statements

DevMiser commented 5 months ago

You do not need to install or import RPi.GPIO separately. It is a part of the official Raspberry Pi OS.

EA914 commented 5 months ago

Gotcha. Thank you.

Another question: how would I make this program automatically start when plugged in? I don't want to have to manually run the script every time. Is this the .bashrc step?

DevMiser commented 5 months ago

I recommend following the instructions in Appendix III of the instructions for Lumina and modify as appropriate: https://github.com/DevMiser/Lumina

EA914 commented 5 months ago

Thank you! That helps.

Can you also help me if I wanted the image that generates on the e-ink display to also show the prompt that generated the image to show up at the bottom of the image how would I go about doing that?

DevMiser commented 5 months ago

I don't have the time to help you with the coding, but you can code this change yourself with a little effort. I recommend trying Tkinter for this purpose. If you have not used Tkinter before, there are many good tutorials that you can find easily with a web search. You can also look at the Lumina.py code on this repository to see how I capture the prompt and display it before the generated image is displayed. You can, of course, display the image and the prompt at the same time if you want to program it that way.

EA914 commented 5 months ago

Thank you. Perhaps you may also be interested in the modification I'm doing. I will share my github repo when I'm done with it. In addition to the DALLE-3 (you can change the model in your code by the way to use dall-e-3 now instead of dall-e-2), I'm programming another wake word of "music box". When that word is detected, the dictated prompt is transcribed and sent to SunoAI, which will generate an AI song and play it via FFMPEG through a USB speaker attached to the Raspberry Pi. After that I'll also program a wake word "robot" or something that will send the prompt to ChatGPT as a chat, and the Raspberry Pi will use OpenAI's text-to-speech and speak back the response. So all-in-one it'll be an AI song generator, an AI picture displayer, and an AI chatbot.

My question is this: from a high-level how would I program the code to have the wake words in one main script, and the separate respective AI calls in separate scripts, each one called when the wake word is detective that triggers that functionality. This way, the separate functionalities won't share or overlap resources and will run separately and not interrupt each other. Does this make sense?

Thanks so much for your prompt responses and help thus far.

DevMiser commented 5 months ago

That sounds like a great project!

I frankly don't have much experience writing programs that call from multiple scripts. You can use add as many keywords to the wake_word() function in my script as you would like. From there, you can write it to do the calls based upon which keyword is detected. If you use it to call separate scripts, you could use the Import statement to import functions, use the subprocess module, or maybe use the os.system() function.

Good luck and I look forward to seeing what you create.

EA914 commented 5 months ago

Thank you! I'll be sure to share it when I'm done.

I am having trouble with the LED filament. I have never soldered before and don't have a soldering iron. I bought this to connect the resistor to the LED filament but I'm not sure it will work: https://a.co/d/c44NdMD

My question is, how far in do I push the resistor and the filament for a "secure" connection? It feels pretty loose. I'm able to thread it all the way through and I feel like that's not right.

Thanks for your help!

EA914 commented 5 months ago

I figured the LED out, but still would like your help for a solution that doesn't involve soldering. Are there like GPIO e extenders I can use to simply "plug" the resistor end and the LED filament end into the Inky Impressions? It's kind of a loose fit and I'm not sure what my solderless options are

DevMiser commented 5 months ago

Because I do solder, I regret that I am not familiar with any good solderless options. You may want to learn to solder. You can buy a decent electronics soldering kit for around $15 and there are a lot of YouTube videos to teach you how to so it.