Create Stunning Videos with Text Prompts Using Cognitive Actions

21 Apr 2025
Create Stunning Videos with Text Prompts Using Cognitive Actions

In the world of content creation, the ability to generate captivating videos based on textual descriptions is a game changer. The zsxkib/hunyuan-video-lora-rose-number-one-girl spec offers powerful Cognitive Actions that allow developers to create videos tailored to their specifications. By leveraging these pre-built actions, developers can automate video generation, saving time and resources while enhancing creativity.

Prerequisites

To get started with the Cognitive Actions, you'll need an API key for the Cognitive Actions platform. This key is essential for authenticating your requests. Generally, you will pass your API key in the headers of your HTTP requests to access the actions securely.

Cognitive Actions Overview

Generate Video with Text Prompts

This action enables users to generate videos based on detailed text prompts and LoRA models. You can customize various parameters such as resolution, frame rate, and noise strength to tailor the output to your needs.

  • Category: Video Generation

Input

The input schema for this action consists of several fields, each playing a crucial role in video generation. Here’s a breakdown of the required and optional fields:

{
  "steps": 30,
  "width": 512,
  "height": 512,
  "prompt": "In the style of RSNG. A woman with blonde hair stands on a balcony at night, framed against a backdrop of city lights. She wears a white crop top and a dark jacket, exuding a confident presence as she gazes directly at the camera",
  "frameRate": 15,
  "loraScale": 1,
  "cpuOffload": true,
  "frameCount": 85,
  "loraFileUrl": "",
  "guidanceScale": 6,
  "qualityFactor": 19,
  "noiseReduction": 1,
  "videoContinuityFactor": 9
}
  • Required Fields:
    • prompt: A textual description for generating the video.
    • steps: Total diffusion steps (default 50, min 1, max 150).
    • width: Video width in pixels (default 640, min 64, max 1536).
    • height: Video height in pixels (default 360, min 64, max 1024).
    • frameRate: Frames per second (default 24, min 1, max 60).
    • frameCount: Total number of frames (default 85, min 1, max 300).
  • Optional Fields:
    • seed: Seed value for consistent generation.
    • loraFileUrl: URL for the LoRA .safetensors file.
    • guidanceScale: Balance between text input and model suggestions (default 6).
    • qualityFactor: CRF for video quality (default 19).
    • cpuOffload: Manage memory resources (default true).
    • loraScale: Strength of the LoRA model (default 1).
    • noiseReduction: Level of noise in diffusion steps (default 1).
    • videoContinuityFactor: Flow adjustment for video continuity (default 9).

Output

Upon executing the action, you will receive a URL pointing to the generated video:

"https://assets.cognitiveactions.com/invocations/9c823a2b-95a8-49c0-a5fe-1e1e8554ab9f/983cfab3-de9e-4b84-aae4-4b49e07a4cd0.mp4"

This output represents the location where the final video can be accessed.

Conceptual Usage Example (Python)

Here’s how you might invoke the Generate Video with Text Prompts action using Python:

import requests
import json

# Replace with your Cognitive Actions API key and endpoint
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"  # Hypothetical endpoint

action_id = "6ab4ff36-db27-40dd-aad9-709606fc7a76"  # Action ID for Generate Video with Text Prompts

# Construct the input payload based on the action's requirements
payload = {
    "steps": 30,
    "width": 512,
    "height": 512,
    "prompt": "In the style of RSNG. A woman with blonde hair stands on a balcony at night, framed against a backdrop of city lights. She wears a white crop top and a dark jacket, exuding a confident presence as she gazes directly at the camera",
    "frameRate": 15,
    "loraScale": 1,
    "cpuOffload": True,
    "frameCount": 85,
    "loraFileUrl": "",
    "guidanceScale": 6,
    "qualityFactor": 19,
    "noiseReduction": 1,
    "videoContinuityFactor": 9
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json"
}

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json={"action_id": action_id, "inputs": payload}  # Hypothetical structure
    )
    response.raise_for_status()  # Raise an exception for bad status codes (4xx or 5xx)

    result = response.json()
    print("Action executed successfully:")
    print(json.dumps(result, indent=2))

except requests.exceptions.RequestException as e:
    print(f"Error executing action {action_id}: {e}")
    if e.response is not None:
        print(f"Response status: {e.response.status_code}")
        try:
            print(f"Response body: {e.response.json()}")
        except json.JSONDecodeError:
            print(f"Response body: {e.response.text}")

In this code snippet, we import the necessary libraries, set our API key and endpoint, and create a payload using the required input schema. The action ID is specific to the "Generate Video with Text Prompts" action. After sending the request, we handle potential errors and print the output.

Conclusion

The zsxkib/hunyuan-video-lora-rose-number-one-girl Cognitive Actions empower developers to create customized video content effortlessly. By integrating this action into your applications, you can enhance user engagement and streamline video production. Explore different parameters to maximize the potential of your video creations and consider implementing additional features like user-generated prompts for an even richer experience.