slidegent / README.md
jomasego's picture
Upload README.md with huggingface_hub
0c25087 verified
|
Raw
History Blame Contribute Delete
4.86 kB

A newer version of the Gradio SDK is available: 6.20.0

Upgrade
metadata
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 submission by @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.

Live Space Demo video LinkedIn post

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

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)

pip install llama-cpp-python huggingface_hub openai
python scripts/local_backend_smoke.py

If you want to force a specific local model path:

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:

MODEL_BACKEND=llama.cpp \
GGUF_MODEL_REPO=unsloth/gemma-4-12b-it-GGUF \
python scripts/local_backend_smoke.py

Tests

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:

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:

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

Build Stamp

2026-06-15T22:15:24.820262+00:00