BinyamHuggingFace/manim-generator
0
Manim Tutorial Generator with Gemini AI
Create beautiful coding tutorials and mathematical animations with AI-powered content generation!
Features
- AI-Generated Tutorials: Creates complete tutorials on coding topics using Google Gemini
- Text-to-Speech Narration: Automatically converts tutorial scripts to speech
- Manim Animations: Generates professional-quality animations to illustrate concepts
- Synchronized Subtitles: Creates subtitle files aligned with narration
- Dual Mode Interface: Choose between simple animations or complete tutorials
Setup
Local Development
- Get a Gemini API Key (free):
- Go to Google AI Studio
- Create a new API key
- Copy it
- Set up Environment:
- Create a
.envfile with your API key:
echo "GOOGLE_API_KEY=your-api-key-here" > .env- Install Dependencies:
# Install uv package manager (recommended)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create a virtual environment
uv venv
# Activate the virtual environment
source .venv/bin/activate
# Install dependencies
uv pip install -r requirements.txt- Run the App:
streamlit run streamlit_app.pyDocker Deployment
- Build and Run with Docker Compose:
# Make sure your .env file has GOOGLE_API_KEY set
docker-compose up -d- Manual Docker Build:
docker build -t manim-tutorial-generator .
docker run -p 8501:8501 -e GOOGLE_API_KEY=your_key_here manim-tutorial-generator- Access the App:
- Open your browser and navigate to
http://localhost:8501
## Example Requests
Try these animation ideas:
- "Create a circle that transforms into a square"
- "Show the Pythagorean theorem with animated triangles"
- "Animate a sine wave being drawn"
- "Create a bouncing ball animation"
- "Show how integration works with rectangles under a curve"
- "Animate the quadratic formula"
- "Create a spinning 3D cube"
- "Show a mathematical proof step by step"
## How It Works
1. **You describe** what animation you want in natural language
2. **Gemini AI generates** proper Manim code based on your description
3. **Manim renders** the animation as an MP4 video
4. **You get** a beautiful mathematical animation!
## Output
- Animations are saved as MP4 files in the current directory
- Each animation is named after the scene class (e.g., `MyAnimation.mp4`)
- Medium quality rendering for faster generation
## Troubleshooting
**"GEMINI_API_KEY not set"**:
- Make sure you exported the API key: `export GEMINI_API_KEY='your-key'`
**"Dependencies not installed"**:
- Activate venv: `source .venv/bin/activate`
- Install deps: `uv pip install -r client_requirements.txt`
**Animation fails to render**:
- Check if the generated code has syntax errors
- Some complex animations might need manual code adjustment
- Try a simpler description first
## Features
- ✨ Natural language to Manim code conversion
- 🎬 Automatic animation rendering
- 🚀 Simple command-line interface
- 🎯 No need to know Manim syntax
- 📱 Works with free Gemini API
Enjoy creating beautiful mathematical animations! 🎉
## Credits
This project is based on the MCP framework developed by [Avik-creator](https://github.com/Avik-creator/MCP.git).
