filipstrand / mflux

A MLX port of FLUX based on the Huggingface Diffusers implementation.
MIT License
910 stars 55 forks source link

Great Work! and works like a charm #8

Closed vincyb closed 2 months ago

vincyb commented 2 months ago

The only issue the generated image was saving in same folder and was replaced my the next generation.

I replaced: image.save("image.png")

with:

Directory to save images

save_dir = "images" if not os.path.exists(save_dir): os.makedirs(save_dir)

Determine the next available file name

image_number = 1 while os.path.exists(f"{save_dir}/image_{image_number}.png"): image_number += 1

Save the image with a sequential file name

image.save(f"{save_dir}/image_{image_number}.png")

filipstrand commented 2 months ago

@vincyb Thanks and good point! It is quite a bad user experience to override previously generated images. I just merged this now which contains a small util method which makes sure that we at least don't do that. In an upcoming PR we will add the ability to specify the output directory via the command line.