CoolFace
Apppublic

BinyamHuggingFace/manim-generator

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
App README

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

  1. 1.Get a Gemini API Key (free):
  2. 2.Go to Google AI Studio
  3. 3.Create a new API key
  4. 4.Copy it
  1. 1.Set up Environment:
  2. 2.Create a .env file with your API key:
bash
   echo "GOOGLE_API_KEY=your-api-key-here" > .env
  1. 1.Install Dependencies:
bash
   # 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
  1. 1.Run the App:
bash
   streamlit run streamlit_app.py

Docker Deployment

  1. 1.Build and Run with Docker Compose:
bash
   # Make sure your .env file has GOOGLE_API_KEY set
   docker-compose up -d
  1. 1.Manual Docker Build:
bash
   docker build -t manim-tutorial-generator .
   docker run -p 8501:8501 -e GOOGLE_API_KEY=your_key_here manim-tutorial-generator
  1. 1.Access the App:
  2. 2.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).