latentblending/example_single_trans.py

24 lines
854 B
Python
Raw Normal View History

2023-11-16 14:37:02 +00:00
import torch
import warnings
2024-01-06 17:16:36 +00:00
from diffusers import AutoPipelineForText2Image
2024-01-10 08:47:35 +00:00
from latentblending.blending_engine import BlendingEngine
2024-01-09 14:58:56 +00:00
2023-11-16 14:37:02 +00:00
warnings.filterwarnings('ignore')
torch.set_grad_enabled(False)
torch.backends.cudnn.benchmark = False
# %% First let us spawn a stable diffusion holder. Uncomment your version of choice.
2024-01-06 17:16:36 +00:00
pipe = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16")
pipe.to("cuda")
be = BlendingEngine(pipe)
2024-01-09 20:07:27 +00:00
be.set_prompt1("photo of underwater landscape, fish, und the sea, incredible detail, high resolution")
be.set_prompt2("rendering of an alien planet, strange plants, strange creatures, surreal")
be.set_negative_prompt("blurry, ugly, pale")
2023-11-16 14:37:02 +00:00
# Run latent blending
2024-01-09 20:07:27 +00:00
be.run_transition()
2023-11-16 14:37:02 +00:00
# Save movie
2024-01-09 20:07:27 +00:00
be.write_movie_transition('movie_example1.mp4', duration_transition=12)