slidegent / scripts /local_backend_smoke.py
jomasego's picture
Upload folder using huggingface_hub
e889541 verified
Raw
History Blame Contribute Delete
1.37 kB
from __future__ import annotations
import os
import sys
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
if str(REPO_ROOT) not in sys.path:
sys.path.insert(0, str(REPO_ROOT))
from src.services.customization_service import customize_presentation
def main() -> int:
repo_root = REPO_ROOT
template = repo_root / "templates" / "base_template.pptx"
backend = os.getenv("MODEL_BACKEND", "llama.cpp")
os.environ.setdefault("MODEL_BACKEND", backend)
if backend == "llama.cpp" and not os.getenv("LLAMA_CPP_MODEL_PATH"):
candidates = [
repo_root / "models" / "gemma-4-12b-it-Q4_K_M.gguf",
repo_root / "models" / "Gemma-4-12b-it-Q4_K_M.gguf",
repo_root / "models" / "Qwen2.5-0.5B-Instruct-Q4_K_M.gguf",
]
for candidate in candidates:
if candidate.exists():
os.environ["LLAMA_CPP_MODEL_PATH"] = str(candidate)
break
output = customize_presentation(
str(template),
"Create a compact 3-slide executive summary about smart warehousing automation.",
)
output_path = Path(output)
print(f"backend={backend}")
print(f"generated={output_path}")
print(f"exists={output_path.exists()}")
return 0 if output_path.exists() else 1
if __name__ == "__main__":
raise SystemExit(main())