JSPM

  • Created
  • Published
  • Downloads 47
  • Score
    100M100P100Q65740F
  • License MIT

Convert strings to videos using Groq API and Manim

Package Exports

  • mathvideo
  • mathvideo/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mathvideo) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

MathVideo

🎬 Convert strings to videos using Groq API and Manim

MathVideo is an npm package that takes a string input and converts it into an animated video using the Groq API (with Llama 2 70B model) and the Manim animation library.

Features

  • 🤖 AI-powered video generation using Groq API
  • 🎥 Beautiful animations created with Manim
  • 🔐 Secure API key management
  • 📁 Automatic output organization with timestamps
  • 🖥️ Cross-platform compatibility

Prerequisites

Before using MathVideo, you need to have the following installed:

  1. Node.js (v14 or higher)
  2. Python (v3.7 or higher)
  3. Manim library

Installing Manim

pip install manim

Installation

npm install -g mathvideo

Local Installation

npm install mathvideo

Usage

First Time Setup

When you run MathVideo for the first time, it will guide you through setting up your Groq API key:

  1. If you don't have a Groq API key:

    • The tool will guide you to https://console.groq.com/
    • Create a new account or log in
    • Navigate to the API Keys section
    • Create a new API key
    • Copy and paste the API key when prompted
  2. If you already have a Groq API key:

    • Simply paste your existing API key when prompted

Your API key will be securely stored for future use.

Creating Videos

mathvideo "Your string here"

Examples

# Create a video about mathematics
mathvideo "The beauty of calculus and derivatives"

# Create a video about physics
mathvideo "Einstein's theory of relativity explained"

# Create a video about programming
mathvideo "How to build a web application with React"

Output

Videos are automatically saved in the output folder with timestamps:

output/
├── 2024-01-15T14-30-25.mp4
├── 2024-01-15T14-35-12.mp4
└── ...

How It Works

  1. Input Processing: Your string is sent to the Groq API
  2. AI Generation: The Llama 2 70B model generates Manim Python code
  3. Video Creation: The generated code is executed to create the video
  4. Output: The final video is saved with a timestamp

Configuration

Your Groq API key is stored in:

  • Windows: %USERPROFILE%\.mathvideo\config.json
  • macOS/Linux: ~/.mathvideo/config.json

Troubleshooting

Common Issues

  1. "Python is not installed"

  2. "Manim is not installed"

    • Run: pip install manim
  3. "Invalid Groq API key"

  4. "Rate limit exceeded"

    • Wait a few minutes and try again
    • Check your Groq API usage limits

Getting Help

If you encounter issues:

  1. Check that Python and Manim are properly installed
  2. Verify your Groq API key is valid
  3. Ensure you have sufficient Groq API credits
  4. Check the console output for detailed error messages

API Key Management

To change your Groq API key:

  1. Delete the config file: ~/.mathvideo/config.json
  2. Run MathVideo again to set up a new API key

License

MIT License - see LICENSE file for details

Contributing

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

Support

For support, please open an issue on the GitHub repository.