Download apps/api/app/orchestration/visual_compiler.py from wassemgtk/glm-5-2-visual-runtime-space: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/spaces/wassemgtk/glm-5-2-visual-runtime-space/resolve/main/apps/api/app/orchestration/visual_compiler.py
- Command line
-
hf download hf://spaces/wassemgtk/glm-5-2-visual-runtime-space/apps/api/app/orchestration/visual_compiler.py
-
curl -L -o visual_compiler.py https://huggingface.co/spaces/wassemgtk/glm-5-2-visual-runtime-space/resolve/main/apps/api/app/orchestration/visual_compiler.py
1.04 kB
| from __future__ import annotations | |
| from app.schemas.plans import VisualOperation, VisualPlan, VisualReference | |
| from app.storage.models import VisualAssetRecord | |
| def compile_visual_plan(intent: str, text: str, asset: VisualAssetRecord | None, views: list[str]) -> VisualPlan: | |
| references = [] | |
| operations = [] | |
| if asset: | |
| for idx, view in enumerate(views, start=1): | |
| references.append(VisualReference(phrase=text[:80], asset_id=asset.id, view=view, confidence=0.86)) | |
| operations.append(VisualOperation(id=f"op_{idx}", op="get_view", asset_id=asset.id, view=view)) | |
| if intent == "create_presentation": | |
| operations.append(VisualOperation(id=f"op_{len(operations)+1}", op="create_presentation", asset_id=asset.id if asset else None, parameters={"content_request": text})) | |
| if not operations: | |
| operations.append(VisualOperation(id="op_1", op="answer_from_evidence", parameters={"content_request": text})) | |
| return VisualPlan(intent=intent, references=references, operations=operations) | |