Create Stunning Ghibli-Style Videos with Cognitive Actions

In the realm of AI-generated content, the shridharathi/ghibli-vid API offers a unique way to create videos in the enchanting style of Studio Ghibli. By utilizing descriptive text prompts, developers can generate videos that capture the essence of this beloved animation style. With customizable options for frames, resolution, and speed, you can balance quality and performance to suit your application needs.
Prerequisites
Before diving into the integration of Cognitive Actions, ensure you have the following:
- An API key for the Cognitive Actions platform to authenticate your requests.
- Basic familiarity with making HTTP requests and handling JSON payloads.
Authentication typically involves passing the API key in the request headers, allowing you to securely access the actions available through the API.
Cognitive Actions Overview
Generate Studio Ghibli Style Video
The Generate Studio Ghibli Style Video action allows you to create a captivating video using a descriptive text prompt that embodies the iconic Studio Ghibli aesthetic. This action falls under the video-generation category.
Input
The input for this action is structured as follows:
{
"prompt": "GHIBLI style, anime, a girl running through new york city",
"frameCount": 81,
"guideScale": 5,
"excludePrompt": "",
"samplingShift": 8,
"generationSpeed": "Balanced",
"generationSteps": 30,
"videoResolution": "480p",
"clipLoraStrength": 1,
"videoAspectRatio": "16:9",
"modelLoraStrength": 1
}
Required Fields:
- prompt: A descriptive text prompt defining the style and content of the video.
Optional Fields:
- seed: An integer for reproducibility (random if omitted).
- image: A URI linking to an initial frame image.
- frameCount: Number of frames (17, 33, 49, 65, or 81).
- guideScale: A value from 0 to 10 determining adherence to the prompt.
- excludePrompt: Elements to exclude from the video.
- samplingShift: Adjusts the sample shift (0 to 10).
- generationSpeed: Speed of generation ("Off", "Balanced", "Fast").
- generationSteps: Steps in the generation process (1 to 60).
- videoResolution: Output resolution ("480p" or "720p").
- clipLoraStrength: Strength of LoRA influence on CLIP model.
- videoAspectRatio: Aspect ratio for the video output (choices include "16:9", "9:16", "1:1").
- modelLoraStrength: Strength of LoRA influence on the model.
Output
Upon successful execution, this action returns a URL to the generated video:
[
"https://assets.cognitiveactions.com/invocations/717b4228-3693-4ab4-bc28-b9dda732b859/8febed94-2c91-4369-89e5-01931fc2fda3.mp4"
]
This URL links directly to the generated video, allowing for immediate access and sharing.
Conceptual Usage Example (Python)
Here's a conceptual example of how you might call this 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 = "0c30f650-b089-4988-88bc-4dc93aac9d9b" # Action ID for Generate Studio Ghibli Style Video
# Construct the input payload based on the action's requirements
payload = {
"prompt": "GHIBLI style, anime, a girl running through new york city",
"frameCount": 81,
"guideScale": 5,
"excludePrompt": "",
"samplingShift": 8,
"generationSpeed": "Balanced",
"generationSteps": 30,
"videoResolution": "480p",
"clipLoraStrength": 1,
"videoAspectRatio": "16:9",
"modelLoraStrength": 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 example, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID and the structured input payload are tailored to the requirements of generating a Studio Ghibli-style video.
Conclusion
Integrating the Generate Studio Ghibli Style Video action into your application opens up a world of creative possibilities, allowing you to generate captivating videos from simple text prompts. With flexible options for customization, developers can produce content that resonates with fans of Studio Ghibli and beyond. Start experimenting with these actions today and bring your imaginative visions to life!