Create Stunning Videos in the Style of 'Her' with Cognitive Actions

In the world of video generation, the deepfates/hunyuan-her spec provides powerful Cognitive Actions that allow developers to create videos in the unique style of the movie "Her" (2013). This integration leverages the Hunyuan-Video model, fine-tuned for stylistic adherence and enhanced video quality. By utilizing these pre-built actions, developers can streamline their video creation process, enabling them to focus more on creativity rather than technical intricacies.
Prerequisites
Before you start using the Cognitive Actions, ensure you have the following:
- An API key for the Cognitive Actions platform.
- Familiarity with making HTTP requests and handling JSON data.
- Basic understanding of video generation concepts.
Authentication typically involves passing your API key in the HTTP headers to access the Cognitive Actions services securely.
Cognitive Actions Overview
Generate Her-Style Video
The Generate Her-Style Video action allows you to create a video that embodies the aesthetic and emotional tone of the film "Her". This action is categorized under video-generation and offers a variety of configurable parameters to tailor the output to your needs.
Input
The action requires a structured input defined by the following schema:
{
"seed": 12345,
"steps": 50,
"width": 640,
"height": 360,
"prompt": "A video in the style of HR...",
"frameRate": 16,
"scheduler": "DPMSolverMultistepScheduler",
"frameCount": 66,
"loraIntensity": 1,
"loraSourceUrl": "",
"qualityFactor": 19,
"enhancementEnd": 1,
"influenceScale": 6,
"continuityFactor": 9,
"enhancementStart": 0,
"applyEnhanceDouble": true,
"applyEnhanceSingle": true,
"enableForceOffload": true,
"enhancementStrength": 0.3,
"noiseReductionStrength": 1
}
Here’s a breakdown of the key input parameters:
- seed: An integer for reproducibility of the video generation. (Example:
12345) - steps: Number of diffusion steps (Acceptable range: 1 to 150). (Example:
50) - width: Width of the video in pixels (Acceptable range: 64 to 1536). (Example:
640) - height: Height of the video in pixels (Acceptable range: 64 to 1024). (Example:
360) - prompt: A textual description that guides the video generation. (Example:
"A video in the style of HR...") - frameRate: Frames per second for smooth playback (Acceptable range: 1 to 60). (Example:
16) - scheduler: The algorithm used for generating video frames. (Example:
"DPMSolverMultistepScheduler") - frameCount: Total number of frames in the video (Acceptable range: 1 to 1440). (Example:
66) - ... and other parameters that fine-tune the quality and style of the video.
Output
Upon successful execution, the action typically returns a URL pointing to the generated video:
https://assets.cognitiveactions.com/invocations/e24f4829-813d-4c11-8b3e-4fe28f0e7730/19eed043-4c41-488f-8782-6955d87640fb.mp4
This URL allows you to download or stream the generated video.
Conceptual Usage Example (Python)
Here’s how you might call this action using a hypothetical Cognitive Actions execution endpoint in 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 = "11e716f0-daf8-4241-b43f-97a94c7dd1b5" # Action ID for Generate Her-Style Video
# Construct the input payload based on the action's requirements
payload = {
"seed": 12345,
"steps": 50,
"width": 640,
"height": 360,
"prompt": "A video in the style of HR...",
"frameRate": 16,
"scheduler": "DPMSolverMultistepScheduler",
"frameCount": 66,
"loraIntensity": 1,
"qualityFactor": 19,
"enhancementEnd": 1,
"influenceScale": 6,
"continuityFactor": 9,
"enhancementStart": 0,
"applyEnhanceDouble": True,
"applyEnhanceSingle": True,
"enableForceOffload": True,
"enhancementStrength": 0.3,
"noiseReductionStrength": 1
}
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, replace the YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable contains the structured input required to generate a video in the style of "Her".
Conclusion
The deepfates/hunyuan-her Cognitive Actions empower developers to create visually stunning videos that capture the essence of the film "Her". By leveraging the extensive parameters available with the Generate Her-Style Video action, you can fine-tune your video creations to meet your specific needs. Whether for artistic expression or practical applications, these actions provide a seamless integration for video generation. Explore further use cases and push the boundaries of your video projects with these powerful tools!