ml-stable-diffusion icon indicating copy to clipboard operation
ml-stable-diffusion copied to clipboard

Add Filename Character Limit

Open dec2-anon opened this issue 3 years ago • 2 comments

Very long prompts cause the error:

Error: saving("Failed to create destination for file:///path/prompt.seed.final.png"

dec2-anon avatar Dec 03 '22 00:12 dec2-anon

Actually might want to change fileCharLimit to a let since it never mutated

dec2-anon avatar Dec 03 '22 00:12 dec2-anon

change fixes too long of a filename issue for me. thanks!

gretel avatar Dec 06 '22 20:12 gretel

Thank you for your interest in contributing to Core ML Stable Diffusion! Please review CONTRIBUTING.md. If you would like to proceed with this pull request, please indicate your agreement to the terms outlined in CONTRIBUTING.md by checking the box below.

We appreciate your interest in the project!

  • [ ] I agree to the terms outlined in CONTRIBUTING.md

msiracusa avatar Dec 14 '22 03:12 msiracusa

  • [x] I agree to the terms outlined in CONTRIBUTING.md

dec2-anon avatar Dec 15 '22 10:12 dec2-anon

@msiracusa as mentioned in #53, please revert this contribution. It incorrectly conflates 75 characters with 75 words. This means users will now have their images overwritten if they change a reasonably complex prompt (e.g. 300 characters and 74 words) by changing the last word.

philipturner avatar Dec 16 '22 06:12 philipturner

My solution factored in not only the file name, but the total path name length. It also allows more varied length in file name and even warns you when it’s going to overwrite a file you didn’t want.

philipturner avatar Dec 16 '22 06:12 philipturner

You're right, this is more of a bandaid fix. But #53 seems to do a lot more than just add a path character limit. Don't know if a separate metadata file is a good idea. It would get messy with lots of generations

If they decide to merge #53 then I suggest we add the metadata description containing the prompt directly to the generated image.

dec2-anon avatar Dec 16 '22 07:12 dec2-anon

@philipturner Followup: I was tinkering with NSAppleScript and I got it to add the metadata details into the kMDItemFinderComment attribute

Screenshot 2022-12-17 at 1 14 12 PM

dec2-anon avatar Dec 17 '22 07:12 dec2-anon

I'll create another PR later today when I rewrite it in native swift code without AppleScript

dec2-anon avatar Dec 17 '22 07:12 dec2-anon