CoolFace
Apppublic

Ani14/Video-agent

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
planning.py60 linesDownload Raw Back to root
1"""2Planning utilities for the agentic WAN‑VACE video generator.3 4This module defines a simple planner that takes a high‑level concept or topic and5returns a refined text prompt and a recommended negative prompt.  The planner6adds cinematic and visual descriptors to the concept to encourage more7engaging video outputs and recommends a default negative prompt to avoid8common artifacts and low‑quality renderings.9 10The planner can be replaced or extended with more sophisticated logic or local11LLMs if desired.12"""13 14from dataclasses import dataclass15from typing import Tuple16 17 18@dataclass19class Plan:20    """A dataclass representing a planned prompt and negative prompt."""21    prompt: str22    negative_prompt: str23 24 25def plan_from_topic(topic: str) -> Plan:26    """27    Generate a refined prompt and a recommended negative prompt from a high‑level topic.28 29    The refined prompt enriches the user's concept with cinematic descriptors and30    details that tend to produce appealing vertical videos.  The negative prompt31    includes terms that discourage common undesirable artifacts.32 33    Parameters34    ----------35    topic: str36        A short description of what the user wants in the video.37 38    Returns39    -------40    Plan41        An object containing a refined prompt and a negative prompt.42    """43    # Base descriptors to enrich the concept. These tokens help guide the model44    # towards vibrant, cinematic compositions. You can customise these tokens45    # depending on your aesthetic preferences.46    base_descriptors = (47        "cinematic, dynamic motion, rich details, warm lighting, volumetric lighting, "48        "bokeh, warm sun rim light, tracking shot, shallow depth of field, vertical 9:16"49    )50    # Compose the refined prompt51    refined_prompt = f"{topic}, {base_descriptors}"52 53    # Recommended negative prompt to avoid low‑quality outputs.  Users can54    # override this by supplying their own negative prompt.55    recommended_negative = (56        "blurry, lowres, artifacts, distorted anatomy, dull colors, washed out, "57        "overexposed, underexposed, jitter, bad compression"58    )59 60    return Plan(prompt=refined_prompt, negative_prompt=recommended_negative)