Adding a more descriptive default output filename
Right now the default output filename is just output.png. This leads to two things that i think are undesirable:
- Whenever you run the script again and you didn't give a custom filename the old file will be overwritten
- It's impossible to retrieve the original prompt from the file
I've changed the default output filename to be a combination of a timestamp and a (sanitized) version of the prompt. So for example, when running the command:
python text2image.py --prompt="An astronaut riding a horse"
You'll now get the filename:
2022-09-28T22.53.20 - An astronaut riding a horse.png
Instead of just output.png. Of course you can still specify your own filename using the --output option.
the problem that i had with such approach is that you easily pass 255 symbols maximum fullpath length :/ So I trim to only first 100 symbols
@ju-popov good point. I've changed the PR to trim the 'prompt slug' to a maximum of 100 characters.