Kilvoctu / aiyabot

A neat Discord bot for AUTOMATIC1111's Web UI
GNU General Public License v2.0
305 stars 79 forks source link

Output images are overwritten when using the same seed. #260

Closed Gecktendo closed 1 week ago

Gecktendo commented 3 months ago

Describe the bug
When you generate images using the same seed, the previous copy of the image is overwritten in the output folder. This makes the bot pull the wrong image when you are trying to retrieve an upscale of previous images. For example, in these pictures, I generated a picture of an asteroid belt, then a picture of an asteroid belt in watercolor. When I tried upscaling the original, it upscaled the watercolor one.


Environment


Console logs
Put any error messages that show in the console log.

wizz13150 commented 3 months ago

Hey, another sneaky one ahah.

For this - as it's only true when using batch>1 - we will re-use the previously commented lines about the seed, to change the epoch_time (part of the filename). To produce a new BatchID when using Edit : https://github.com/Kilvoctu/aiyabot/blob/4b3b62f3065f6d458bea328abd8fa1e0633d7a48/core/stablecog.py#L680-L684

to :

# increment epoch_time for view when using batch
if count != len(image_data):
    new_epoch = list(queue_object.view.input_tuple)
    new_epoch[20] = int(time.time())
    new_tuple = tuple(new_epoch)
    queue_object.view.input_tuple = new_tuple

NB: It's new_epoch[20] for the new version of the bot, but it's new_epoch[18] if using an old version. cf. The tuple in viewhandler : https://github.com/Kilvoctu/aiyabot/blob/4b3b62f3065f6d458bea328abd8fa1e0633d7a48/core/viewhandler.py#L37

Cheers ! 🥂

Gecktendo commented 1 week ago

Just circling back to this, seems like there's a fix available but is there any chance this will get pushed to live?