This project generates AI-powered animations from text prompts using Stable Diffusion and PyTorch. It transforms text descriptions into animated sequences, making it useful for artists, content creators, and AI enthusiasts.
Table of Contents Features Installation Usage How It Works Dependencies Customization License Features Converts text descriptions into animations using AI. Generates high-quality frames with Stable Diffusion. Supports custom frame rates and animation lengths. Uses PyTorch and Diffusers for deep learning. Installation Step 1: Clone the Repository bash Copy Edit git clone https://github.com/your-username/text-to-animation.git cd text-to-animation Step 2: Install Dependencies bash Copy Edit pip install torch torchvision diffusers transformers imageio Step 3: Load the Model python Copy Edit from diffusers import StableDiffusionPipeline import torch
device = "cuda" if torch.cuda.is_available() else "cpu" pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4").to(device) Usage Run the script and enter a text prompt to generate an animation.
python generate_animation.py Example output:
Edit Enter a description for your animation: A futuristic city at night Generating frame 1/10... Generating frame 2/10... Animation saved as animation.gif How It Works Takes a text prompt from the user. Generates a sequence of images using Stable Diffusion. Saves the frames and compiles them into an animation. Dependencies Python 3.x PyTorch Diffusers Transformers Imageio Customization Change the Number of Frames Modify num_frames in the script:
Edit num_frames = 20 # Default: 10 Adjust Frame Rate Modify fps in imageio.mimsave():
imageio.mimsave("animation.gif", frames, fps=5) # Default: 3 License This project is open-source under the MIT License.