2023-11-16 14:37:02 +00:00
|
|
|
import torch
|
|
|
|
import warnings
|
|
|
|
from latent_blending import LatentBlending
|
|
|
|
from diffusers_holder import DiffusersHolder
|
2024-01-06 17:16:36 +00:00
|
|
|
from diffusers import AutoPipelineForText2Image
|
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")
|
|
|
|
|
2023-11-16 14:37:02 +00:00
|
|
|
dh = DiffusersHolder(pipe)
|
|
|
|
|
|
|
|
lb = LatentBlending(dh)
|
2024-01-09 14:55:42 +00:00
|
|
|
lb.set_prompt1("photo of underwater landscape, fish, und the sea, incredible detail, high resolution")
|
|
|
|
lb.set_prompt2("rendering of an alien planet, strange plants, strange creatures, surreal")
|
|
|
|
lb.set_negative_prompt("blurry, ugly, pale")
|
2023-11-16 14:37:02 +00:00
|
|
|
|
|
|
|
# Run latent blending
|
2024-01-09 14:55:42 +00:00
|
|
|
lb.run_transition()
|
2023-11-16 14:37:02 +00:00
|
|
|
|
|
|
|
# Save movie
|
2024-01-09 14:55:42 +00:00
|
|
|
lb.write_movie_transition('movie_example1.mp4', duration_transition=12)
|