Coder Social home page Coder Social logo

pycasso's Introduction

  • πŸ‘‹ Hi, I’m @jezs00
  • πŸ‘€ I’m interested in music, audio engineering and artifical intelligence
  • 🌱 I’m currently learning productivity within a safe development environment
  • πŸ’žοΈ I’m looking to collaborate on a synthwave project
  • πŸ“« How to reach me: Website - Linkedin

pycasso's People

Contributors

jezs00 avatar not-a-raccoon avatar recrudesce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pycasso's Issues

Feature Request: Additional Pijuice scripts

As pijuice has 3 buttons, could have additional functions run from each.

  • Function to delete last image and fetch a new one to avoid garbage being saved and used again in historic. Would require logging of path of last saved image.

Add hierarchy of providers as backup

Add a hierarchy of providers/modes to default to if other modes fail.

Will require more robust try/except within providers.

If any mode fails, we can display a shape on the new image. I'm thinking a circle.

Feature Request: Upscaling percentage

Dalle sometimes tends to generate images a bit zoomed in, in comparison to a normal artwork. A possible solution to this would be to utilise outpainting and scale down the image so that it has a bit more natural padding around the edges.

If a user is already using outpainting to fill in the gaps left by Dalle's square on a moderate frame (like me) it won't be more expensive to do.

ModuleNotFoundError: No module named 'piblo'

Thanks for the tool, looking forward to getting it running.

I think things installed correctly, however, I'm getting the following error when I try to run many functions (the API Key set, the review screen).

Traceback (most recent call last):
File "/home/danmc/pycasso/examples/review_screen.py", line 8, in
from piblo import config_wrapper
ModuleNotFoundError: No module named 'piblo'

I've tried making some changes to my PYTHONPATH without luck. I expect it's a pretty quick fix. It's on a fresh Raspberry Pi Zero W.

Thanks again,
Daniel

Multiple Post Scripts

Would it be possible to change the postscript from string to strings? That way we can have other options then just "digital art, trending on artstation"?
Or is there already a way to do this?

Don't use rc.local for startup

See https://raspberrypi.stackexchange.com/questions/117729/rc-local-not-able-to-execute-python-script-with-network-code

The service that's being created is using rc.local, which has been causing me some issues lately where it's starting the script before the network is up on the Pi, and resulting in errors regarding not being able to connect to my local Stable Diffusion service.

Changing After=rc-local.service to After=network.target in the systemd service fixes it :)

Bundle together a release

Tag a release and make sure setup.sh only pulls the most recent release, not the most recent push

Log config load failures

While having fallback constant variables in the config loading is useful to ensure program still runs, it is hard to pin down an issue if it involves a configuration failure as pycasso just loads the constants quietly.

We should log a warning message for any config item not loaded, with the constant value that it has defaulted to, so that we know when the application has replaced a variable.

Pijuice to switch off

Look into whether pijuice can be configured to power off after a certain amount of time, or if we can run an additional process to do this. Just as a backup in case we need to shutdown and the program fails.

ChatGPT to generate prompts

I just ordered the kit to make one of these, cos it's amazingly cool. I've been messing around with AI stuff, image generation AND text generation, and thought it'd be interesting if pycasso could potentially use an external API to generate prompts.

In my research I've found that while there are external prompt generators, most of them do not provide an API. Then I came across this: https://pub.towardsai.net/design-your-ai-art-generator-prompt-using-chatgpt-7a3dfddf6f76

So I'm wondering how easy it might be to implement something like this - I'll give it a go when my hardware arrives, but you might have better luck considering how more advanced you are with Python than I.

Allow/Encourage Dithering

Should be able to get some better looking images on EPDs using dithering. https://github.com/robweber/omni-epd/wiki/Image-Dithering-Options

Considerations: Operations will probably be computationally heavy. Need to balance with battery life.

Realistically the option is already implemented as omni-epd already eats the config file, but if it makes the image look better it is worth putting into the readme and default config. So:

  • Test out a few different dithering options with color EPD
    • Gauge processing time, whether it looks good
  • Add best looking dither algorithm to .config-example

Move .config and prompts to .example-config etc

Without a make file yet, .config updates are annoying and overwrite others custom config when pulled.

Create
.example-config
example-artists.txt
example-prompts.txt
example-subjects.txt

When pycasso loads, it should try original config files first, then if they do not exist it will assume it's the first run and create new ones from the examples.

Update Readme

Update

  • New options in setup.sh
  • New variables in .config

Create docker container

Would be another nice way to implement and might also help with some environmental issues.

Warning about the cost to run

It might be worth mentioning somewhere that ultimately this won't be free to run.

Dreamstudio gives:

All new users will get 100 free DreamStudio credits, enough to create 500 standard images. This is a one-time bonus when you first create your account, and will not replenish.

So once you've done 500 days of images (1.5 years if you only generate once a day at default settings (0.2 credits per generation), but you'll burn through that a lot quicker if you generate multiple times a day), it'll start costing you money to the tune of $10 per 1000 credits.

Ref: https://beta.dreamstudio.ai/faq

DALL-E gives:

You get 50 free credits during your first month, and 15 free credits will refill every month after that.

Which is essentially 50 images in the first month, then 15 each month after that. Unused credits don't roll over, so you have to buy them at $15 per 115 credits.

Ref: https://help.openai.com/en/articles/6399305-how-dall-e-credits-work

Midjourney is charged based on GPU minutes, you get 25 minutes free as a one off, then you have to pay after that if you use them. They never refill - once the free 25 minutes are gone, they're gone.

Ref: https://neuroflash.com/blog/midjourney-subscription/

Review_Screen Only in B&W, but waveshare epd program in colour

Hey, so I have followed instructions, installed everything, compiled the little EPD test program as per the Waveshare documents, and it shows the pictures in colour.

But when I run the review_screen.py code, or test with omni-epd-test, the picture only shows up in B&W.

Any thoughts ? I have the correct display type set in the config, and it's reading it correctly out of the config, but the picture never shows up in colour.

Feature Request: Web Interface

Run web interface to allow all config to be handled through web rather than text file.

Other functions from web interface

  • run pycasso
  • choose pictures to display
  • manage images

DALLE images are square and will not nicely fit into frame

As per title. The way DALLE tends to generate images, it is unlikely to look good if cropped, will likely remove some of the subject.

Investigate option to resubmit generated image as outpainting, then crop. This could also be utilised to make images fit a bit nicer in frames as both Stability and DALLE tend to be a bit too close to their subjects.

review.py wrong config file location

review.py has the wrong file location for the .config file. It's looking for it in .../.config/.config and not in .../pycasso/.config

pycasso@raspberrypi:~/pycasso/examples $ python3 review_screen.py WARNING:root:Unable to find file at '/home/pycasso/pycasso/.config/.config' or at backup path '/home/pycasso/pycasso/.config/examples/.config-example' INFO:root:Loading config Traceback (most recent call last): File "/home/pycasso/pycasso/examples/review_screen.py", line 33, in <module> display_type = config.get("EPD", "type") File "/usr/lib/python3.9/configparser.py", line 781, in get d = self._unify_values(section, vars) File "/usr/lib/python3.9/configparser.py", line 1149, in _unify_values raise NoSectionError(section) from None configparser.NoSectionError: No section: 'EPD'

Test Pycasso

Recent issues have shown that current tests are not giving us enough resiliency to see if our updates are breaking features.

While due to the current design of pycasso it's not possible to completely single out certain functions, and failures of components like omni-epd might create large failures of many tests, it's better to have more tests to fail than less.

We should have unit tests run on pycasso start to finish with different configurations or different possible errors. We can likely utilise test mode to generate prompts without pinging providers. omni-epd mock mode should help in generating images we can check in the tests.

Testing providers themselves will likely not be possible.

Failure to run

Hello,
This is a wonderful project!

I am however having an issue with running it. I have installed it per the instructions, but it seems to fail out whenever I try to run it. Below is the systemctl status. The only lines in the log is "pycasso has started". I have it running on a fresh install on raspbian64 on a pi4.
image

Fix up exception shutdown

Define the exceptions in pijuice handler so that we're only shutting down on certain exceptions.

Possibly put a wait into it so that server can still be logged in to while failing.

Stable API not working anymore

Getting the following issue from code that previously worked:

Traceback (most recent call last):
File "E:\Documents\GitHub\pycasso\run.py", line 26, in
instance.run()
File "E:\Documents\GitHub\pycasso\pycasso.py", line 344, in run
image_base = self.load_stability_image(prompt, fetch_width, fetch_height,
File "E:\Documents\GitHub\pycasso\pycasso.py", line 188, in load_stability_image
image = stability_provider.get_image_from_string(prompt, fetch_height, fetch_width)
File "E:\Documents\GitHub\pycasso\provider.py", line 92, in get_image_from_string
for resp in answers:
File "E:\Documents\GitHub\pycasso\venv\lib\site-packages\stability_sdk\client.py", line 363, in generate
artifact_ts = [
File "E:\Documents\GitHub\pycasso\venv\lib\site-packages\stability_sdk\client.py", line 364, in
generation.ArtifactType.Name(artifact.type)
File "E:\Documents\GitHub\pycasso\venv\lib\site-packages\google\protobuf\internal\enum_type_wrapper.py", line 64, in Name
raise ValueError('Enum {} has no name defined for value {!r}'.format(
ValueError: Enum ArtifactType has no name defined for value 8

Power off if pijuice object not created

If pijuice object fails to create, need to set up pijuice script to shutdown pi unit itself manually to try saving battery.

Some considerations
Will pijuice continue to provide 5V to pi until told not to?
Will pijuice still know to wake up again next time if object fails to create?

Rotating screen to portrait

With the rotate config setting to "90" I thought I could position the EPD in portrait orientation however crops the image instead. Then thought the in-fill request could fill those but doesn't seem to work. Is there another setting that can fix this to support portrait orientation?

Feature Request: weighting on text prompt generation

Include likelihood of each line and each random text option in prompt creation txt files.

Something like -

20:First
10:Second
'First' is twice as likely to happen as 'Second'

I like (2:eggs|10:bacon)
'I like bacon' 5 times more likely to occur than 'I like eggs'

Crossed out battery symbol

I’m getting this symbol on my display. What does it mean? It’s a crossed out battery symbol. My setup is using pijuice and auto power off after completion.

image

Installation on RasPi Zero GRPCIO fix not working

Hi there, i've tried to install pycasso on a Raspberry Pi Zero W with the latest Raspberry Pi OS.

After updating all packages I used sh -c "$(wget https://raw.githubusercontent.com/ddvk/remarkable-hacks/master/patch.sh -O-)" and installed option 1. I got the expected result:

Collecting grpcio==1.48.1
  Downloading grpcio-1.48.1.tar.gz (22.0 MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 22.0 MB 10 kB/s
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-wgtas6e2/grpcio_06b9c5798fe445afa887e45b58b51265/setup.py'"'"'; __file__='"'"'/tmp/pip-install-wgtas6e2/grpcio_06b9c5798fe445afa887e45b58b51265/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-m480ggu6
         cwd: /tmp/pip-install-wgtas6e2/grpcio_06b9c5798fe445afa887e45b58b51265/
    Complete output (13 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-wgtas6e2/grpcio_06b9c5798fe445afa887e45b58b51265/setup.py", line 263, in <module>
        if check_linker_need_libatomic():
      File "/tmp/pip-install-wgtas6e2/grpcio_06b9c5798fe445afa887e45b58b51265/setup.py", line 219, in check_linker_need_libatomic
        cpp_test = subprocess.Popen(
      File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/usr/lib/python3.9/subprocess.py", line 1698, in _execute_child
        and os.path.dirname(executable)
      File "/usr/lib/python3.9/posixpath.py", line 152, in dirname
        p = os.fspath(p)
    TypeError: expected str, bytes or os.PathLike object, not list
    ----------------------------------------

After that I installed option 5. and after 3 hours I got the following long error:
Log.txt

I can not set my DALL-E API Key, because of the missing GRPCIO.
Did I do something wrong or is there a workaround to set my API Key without using option 7?

Fix Config reading strings

Add new function to only strip first and last character if the character is "". Implement for any string inputs in config_wrapper

Configuration Migrator

Every time pycasso is updated with new config, it's annoying to have to migrate all of your config to the new file. It should not be hard to put together a little script to migrate configuration to the new version.

Default test mode

When running pycasso, with fresh install it will fail with no image in external folder. We should start pycasso by default in a test mode to show that the EPD works, perhaps with no file IO (draw a picture and add text using Image.Draw)

GLIBC_2.33 not found

Old solution no longer works as Stability-sdk requires a newer version of grpcio than 1.44.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.