mix1009 / sdwebuiapi

Python API client for AUTOMATIC1111/stable-diffusion-webui
MIT License
1.35k stars 181 forks source link

Does animatediff function added to the webuiapi? #178

Open Louis24 opened 1 month ago

Louis24 commented 1 month ago

Does animatediff function added to the webuiapi?

mix1009 commented 1 month ago

Added AnimateDiff extension support :)

adiff = webuiapi.AnimateDiff(model='mm_sd15_v3.safetensors',
                             video_length=24,
                             closed_loop='R+P',
                             format=['GIF'])

r = api.txt2img(prompt='cute puppy', animatediff=adiff)

# save GIF file. need save_all=True to save animated GIF.
r.image.save('puppy.gif', save_all=True)

# Display animated GIF in Jupyter notebook
from IPython.display import HTML
HTML('<img src="data:image/gif;base64,{0}"/>'.format(r.json['images'][0]))
Louis24 commented 1 month ago

thank you sooo much!! did you update last week. cuz I have not found the api 2 weks ago

mix1009 commented 1 month ago

It was added today :)

Louis24 commented 1 month ago

It was added today :)

Haha, thanks, by the way, how about lora, does it still need to be loaded through style.csv?

And style.csv should be prepared before the server starts, otherwise it cannot be refreshed.

Louis24 commented 1 month ago

new issue here, with r.image.save('puppy.gif', save_all=True) can only save 1 frame.

mix1009 commented 1 month ago

Could you check your PIL library version?

import PIL
print(PIL.__version__)

I'm on 10.2.0. It saved 4.8 MB gif file with 24 512x512 frames.

Louis24 commented 1 month ago

Could you check your PIL library version?

import PIL
print(PIL.__version__)

I'm on 10.2.0. It saved 4.8 MB gif file with 24 512x512 frames.

Thank you, I have updated the animatediff extension and solved!