| --- |
| title: slidegent |
| emoji: "π" |
| colorFrom: blue |
| colorTo: gray |
| sdk: gradio |
| sdk_version: 5.34.2 |
| app_file: app.py |
| python_version: "3.11" |
| pinned: false |
| --- |
| |
| # Slidegent β PowerPoint Template Customizer |
|
|
| > **[Build Small Hackathon 2026](https://huggingface.co/build-small-hackathon) submission by [@jomasego](https://huggingface.co/jomasego)** |
|
|
| Upload any `.pptx` template, describe what you need, and get a fully styled, multi-slide presentation back in seconds β powered by **google/gemma-4-12b-it** on ZeroGPU. |
|
|
| [](https://huggingface.co/spaces/build-small-hackathon/slidegent) |
| [](https://www.loom.com/share/d7e25c7a114b4deda6b8de63abcba6a7) |
| [](https://www.linkedin.com/posts/jmsegui_buildsmallhackathon-huggingface-opensource-share-7472435145162080257-qxf5/) |
|
|
| Generate styled presentations from a user-provided `.pptx` design template, guided by LLM-produced structured slide JSON. |
|
|
| ## What This App Does |
| - Accepts a template upload (`.pptx`) and a freeform topic prompt. |
| - Parses template style hints (font/color/layout and shape geometry) from slide `0` or `1`. |
| - Calls a Gemma-style chat model with a strict JSON schema requirement. |
| - Defensively parses/validates malformed model outputs. |
| - Compiles a downloadable `.pptx` using `python-pptx` and template-derived style signals. |
|
|
| ## Required Dependencies |
| The required runtime dependencies are in `requirements.txt`: |
| - `gradio` |
| - `transformers` |
| - `torch` |
| - `accelerate` |
| - `python-pptx` |
| - `spaces` |
|
|
| Space runtime is pinned in `runtime.txt` to Python 3.11 for better binary wheel compatibility (notably `llama-cpp-python`). |
|
|
| Optional local-backend/deployment tooling used for deeper validation: |
| - `llama-cpp-python` |
| - `openai` (for vLLM OpenAI-compatible server) |
| - `huggingface_hub` |
|
|
| ## Run Locally |
| ```bash |
| python -m venv .venv |
| source .venv/bin/activate |
| pip install -r requirements.txt |
| python app.py |
| ``` |
|
|
| ## Backend Options |
| Set `MODEL_BACKEND` environment variable: |
| - `llama.cpp` (default): uses GGUF and auto-resolves from `unsloth/gemma-4-12b-it-GGUF` when `LLAMA_CPP_MODEL_PATH` is not set. |
| - `transformers`: optional fallback that uses `unsloth/gemma-4-12b-it` through Hugging Face Transformers. |
| - `vllm`: uses OpenAI-compatible endpoint (`VLLM_BASE_URL`, `VLLM_MODEL_NAME`). |
|
|
| GGUF-related environment variables: |
| - `GGUF_MODEL_REPO` (default: `unsloth/gemma-4-12b-it-GGUF`) |
| - `GGUF_CACHE_DIR` (default: `models`) |
| - `LLAMA_CPP_MODEL_PATH` (optional explicit path override) |
| - `ENABLE_STARTUP_WARMUP` (`auto` by default; on Spaces this pre-caches model files at startup in a background thread) |
|
|
| Startup warmup behavior: |
| - In Space environments (`SPACE_ID`/`HF_SPACE_ID` present), warmup auto-starts by default. |
| - Set `ENABLE_STARTUP_WARMUP=false` to disable. |
| - Set `ENABLE_STARTUP_WARMUP=true` to force warmup in local environments. |
|
|
| ## Quick Local Backend Smoke Test (`llama.cpp`) |
| ```bash |
| pip install llama-cpp-python huggingface_hub openai |
| python scripts/local_backend_smoke.py |
| ``` |
|
|
| If you want to force a specific local model path: |
| ```bash |
| MODEL_BACKEND=llama.cpp \ |
| LLAMA_CPP_MODEL_PATH=/absolute/path/to/model.gguf \ |
| python scripts/local_backend_smoke.py |
| ``` |
|
|
| Or rely on auto-download from Hugging Face: |
| ```bash |
| MODEL_BACKEND=llama.cpp \ |
| GGUF_MODEL_REPO=unsloth/gemma-4-12b-it-GGUF \ |
| python scripts/local_backend_smoke.py |
| ``` |
|
|
| ## Tests |
| ```bash |
| pytest -q |
| ``` |
|
|
| ## Hugging Face ZeroGPU Space Deployment |
| 1. Create a new Space under your account (`SDK: Gradio`, hardware can stay CPU/ZeroGPU-compatible). |
| 2. Push this folder to that Space repository. |
| 3. Ensure `app.py` is at repo root and dependencies are in `requirements.txt`. |
| 4. Add any runtime environment variables in Space settings (`MODEL_BACKEND`, etc). |
|
|
| Example creation/push flow with token: |
| ```bash |
| export HF_TOKEN=your_token_here |
| python - <<'PY' |
| from huggingface_hub import HfApi |
| api = HfApi(token="${HF_TOKEN}") |
| api.create_repo(repo_id="jomasego/powerpoint-template-customizer-zerogpu", repo_type="space", exist_ok=True, space_sdk="gradio") |
| print("Space ready") |
| PY |
| ``` |
|
|
| Then push with git: |
| ```bash |
| git init |
| git add . |
| git commit -m "Initial ZeroGPU app" |
| git remote add origin https://huggingface.co/spaces/jomasego/powerpoint-template-customizer-zerogpu |
| git push -u origin main |
| ``` |
|
|
| ## Links |
| - π€ [Live Space](https://huggingface.co/spaces/build-small-hackathon/slidegent) |
| - πΉ [Demo video](https://www.loom.com/share/d7e25c7a114b4deda6b8de63abcba6a7) |
| - πΌ [LinkedIn post](https://www.linkedin.com/posts/jmsegui_buildsmallhackathon-huggingface-opensource-share-7472435145162080257-qxf5/) |
| - ποΈ [Build Small Hackathon](https://huggingface.co/build-small-hackathon) |
|
|
| ### Build Stamp |
| 2026-06-15T22:15:24.820262+00:00 |
|
|