CoolFace
Apppublic

Shivp1413/local-ai-video-generator

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
App README

Local AI Video Generator ๐ŸŽฌ

Generate creative videos using artificial intelligence right from your local machine! This Streamlit application leverages the CogVideoX-5b model to transform text prompts into engaging video sequences.

<table> <tr> <td><b>Panda Jumping on Moon</b></td> <td><b>Cars racing on Race-track </b></td> </tr> <tr> <td><img src="jumpingpanda.gif" width="400"/></td> <td><img src="3carracing.gif" width="400"/></td> </tr> </table>

๐ŸŒŸ Features

  • โ€”Text-to-video generation using CogVideoX-5b model
  • โ€”User-friendly web interface built with Streamlit
  • โ€”Adjustable video length (8 frames = 1 second of video)
  • โ€”Custom random seed for reproducible results
  • โ€”Supports both CPU and GPU acceleration
  • โ€”Easy video download in MP4 format
  • โ€”Real-time system information display

๐Ÿ› ๏ธ Prerequisites

  • โ€”Python 3.9 or higher
  • โ€”CUDA-capable GPU (recommended) or CPU
  • โ€”12GB+ RAM recommended
  • โ€”Windows/Linux/MacOS

โš™๏ธ Installation

  1. 1.Clone the repository
bash
   git clone https://github.com/Shivp1413/local-ai-video-generator.git
   cd local-ai-video-generator
  1. 1.Create a virtual environment
bash
   # Windows
   python -m venv venv
   venv\Scripts\activate

   # Linux/MacOS
   python -m venv venv
   source venv/bin/activate
  1. 1.Install required packages
bash
   pip install -r requirements.txt

๐Ÿš€ Usage

  1. 1.Start the application
bash
   streamlit run src/app.py
  1. 1.Access the interface
  2. 2.Open your web browser
  3. 3.Navigate to http://localhost:8501
  1. 1.Generate a video
  2. 2.Enter your creative prompt in the text area
  3. 3.Adjust the number of frames (8 frames = 1 second)
  4. 4.Set a random seed if you want reproducible results
  5. 5.Click "Generate Video" and wait for the process to complete
  6. 6.Download your video using the download button

๐Ÿ“ Example Prompts

Try these example prompts:

  • โ€”"A panda playing guitar in a bamboo forest"
  • โ€”"A spaceship flying through colorful nebulae"
  • โ€”"A timelapse of a flower blooming in a garden"
  • โ€”"A robot dancing in a futuristic city"

โšก Performance Tips

  1. 1.GPU Acceleration
  2. 2.For optimal performance, use a CUDA-capable GPU
  3. 3.Make sure you have the latest NVIDIA drivers installed
  4. 4.The application will automatically detect and use GPU if available
  1. 1.Memory Usage
  2. 2.Reduce number of frames for faster generation
  3. 3.Close other memory-intensive applications
  4. 4.Monitor system resources in the sidebar

๐Ÿ”ง Troubleshooting

Common Issues:

  1. 1.CUDA/GPU Issues
   Error: Torch not compiled with CUDA enabled

Solution: Install the CUDA-enabled version of PyTorch:

bash
   pip uninstall torch
   pip install torch --index-url https://download.pytorch.org/whl/cu118
  1. 1.Memory Issues
   CUDA out of memory

Solution: Reduce the number of frames or try running on CPU

  1. 1.Model Loading Issues
  2. 2.Check your internet connection
  3. 3.Ensure you have enough disk space
  4. 4.Try clearing your cache

๐Ÿ“ Project Structure

local-ai-video-generator/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app.py          # Main Streamlit interface
โ”‚   โ”œโ”€โ”€ model.py        # Model loading and configuration
โ”‚   โ””โ”€โ”€ utils.py        # Helper functions
โ”œโ”€โ”€ requirements.txt    # Package dependencies
โ”œโ”€โ”€ .gitignore         # Git ignore rules
โ””โ”€โ”€ README.md          # Project documentation

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

โญ Show Your Support

If you find this project useful, please consider giving it a star on GitHub!

๐Ÿ“ง Contact

If you have any questions or suggestions, feel free to open an issue on GitHub.


Happy Video Generating! ๐ŸŽฅโœจ