Download src/generators/image/from_plan.py from pratik-250620/MultiModal-Coherence-AI: direct link, hf CLI and curl.
- Browser
- Download file 536 Bytes
-
https://huggingface.co/spaces/pratik-250620/MultiModal-Coherence-AI/resolve/main/src/generators/image/from_plan.py
- Command line
-
hf download hf://spaces/pratik-250620/MultiModal-Coherence-AI/src/generators/image/from_plan.py
-
curl -L -o from_plan.py https://huggingface.co/spaces/pratik-250620/MultiModal-Coherence-AI/resolve/main/src/generators/image/from_plan.py
536 Bytes
| from __future__ import annotations | |
| from src.planner.schema_to_text import plan_to_canonical_text | |
| from .generator import ImageRetrievalGenerator | |
| class PlanToImage: | |
| def __init__(self): | |
| self.generator = ImageRetrievalGenerator() | |
| def run(self, semantic_plan, out_path: str) -> str: | |
| prompt = plan_to_canonical_text(semantic_plan) | |
| results = self.generator.retrieve_top_k(prompt, k=1) | |
| if not results: | |
| raise RuntimeError("No images available for retrieval.") | |
| return results[0][0] | |