Spaces:
Running
Running
A newer version of the Gradio SDK is available: 6.12.0
metadata
title: PDF → Manim → LLM App
emoji: 🎬
colorFrom: red
colorTo: blue
sdk: gradio
sdk_version: 6.8.0
python_version: '3.11'
app_file: app.py
pinned: false
🎬 PDF → Manim Animation Pipeline
Upload a PDF → Gemini generates a Manim animation → watch it in-app and download the artifacts.
🚀 Deploy on Hugging Face Spaces
- Create a new Space (SDK: Gradio, any CPU hardware).
- Upload all files in this folder.
- No secrets required — users supply their own Gemini API key in the UI.
🖥️ Usage
- Upload a PDF.
- Enter your Gemini API key (saved in your browser — enter once).
- Click Generate Video.
- Watch live status and the generated Manim code appear in real time.
- When complete:
- ▶️ Video player — watch the animation directly in the browser.
- ⬇️ Artifacts ZIP — download
<job_id>.py+OutputVideo.mp4.
🏗️ Architecture
PDF Upload
│
▼
Extract Text (pypdf)
│
▼
Gemini 3 Flash Preview → code shown live in UI
│
▼
Manim Render (-qm, 1280×720, 30fps)
│
▼
Video Player + artifacts_<job_id>.zip download
📁 File Structure
.
├── app.py # Gradio UI — streaming status, video player, zip download
├── pipeline.py # Job orchestrator
├── queue_manager.py # Thread-pool queue (max 100 jobs)
├── utils.py # PDF extraction, Gemini streaming, code sanitisation
├── requirements.txt # Python deps
├── packages.txt # System deps (LaTeX, ffmpeg, cairo…)
└── README.md
⚙️ System Packages (packages.txt)
Manim requires LaTeX and ffmpeg. These are installed automatically by HF Spaces:
ffmpeg,libcairo2-dev,libpango1.0-devtexlive-latex-base,texlive-latex-extra,texlive-fonts-recommendeddvipng,dvisvgm,ghostscript
🐛 Troubleshooting
| Issue | Fix |
|---|---|
latex not found |
Ensure packages.txt is at the repo root |
| Render timeout | Use higher-tier hardware or shorten animation in prompt |
| Gemini API error | Check API key and quota at aistudio.google.com |
| Empty PDF | PDF must have selectable text (not a scanned image) |