Create Stunning Videos with Glass Face Vid Cognitive Actions

In today's digital landscape, video content reigns supreme. With the rise of social media platforms and video-sharing sites, the demand for engaging visual content has never been higher. Enter "Glass Face Vid," a powerful Cognitive Action that allows developers to transform static images and text prompts into dynamic videos. This service simplifies the video generation process, enabling you to create visually stunning outputs quickly and efficiently.
Imagine being able to generate a captivating video from a single image, enhanced by your creative text prompts. Whether you're building a marketing campaign, enhancing user-generated content, or creating artistic pieces, the Glass Face Vid actions can help streamline your workflow and elevate your projects.
Prerequisites
To get started with Glass Face Vid, you'll need an API key for the Cognitive Actions service and a basic understanding of how to make API calls.
Generate Video from Image and Text Prompts
Purpose
The "Generate Video from Image and Text Prompts" action allows you to create videos based on an initial image and descriptive text prompts. This action is particularly valuable for developers looking to automate video content creation, ensuring high-quality outputs while providing options to customize the generation process.
Input Requirements
To use this action, you'll need to provide a JSON object containing the following parameters:
- prompt: A descriptive text prompt guiding the video generation.
- image: The URI of the starting image for video creation.
- numberOfFrames: The number of frames to generate, which impacts the video's duration.
- generationSteps: The number of steps for generating each frame, affecting quality.
- videoResolution: The resolution of the output video (e.g., 480p, 720p).
- guideScaleFactor: Controls adherence to the text prompt.
- videoAspectRatio: The aspect ratio of the video (e.g., 16:9, 9:16, 1:1).
- sampleShiftFactor: Defines the shift factor for sampling.
- undesiredElements: Elements to exclude from the video.
- generationSpeedMode: Selects the speed of generation, influencing quality.
- loraStrengthForClip: Adjusts the strength of LORA applied to the CLIP model.
- loraStrengthForModel: Adjusts the strength of LORA applied to the main model.
Expected Output
The action returns a URL link to the generated video, allowing you to access and share your creation easily.
Use Cases for this Specific Action
- Marketing Campaigns: Create promotional videos from product images and engaging text that highlights features or offers.
- Social Media Content: Automate the generation of eye-catching videos that can be shared across platforms to engage audiences.
- Creative Projects: Artists and developers can use this tool for unique visual storytelling, combining imagery and narrative in a novel way.
- User-Generated Content: Encourage users to submit images and text for automated video creation, enhancing community engagement and content diversity.
import requests
import json
# Replace with your actual Cognitive Actions API key and endpoint
# Ensure your environment securely handles the API key
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
# This endpoint URL is hypothetical and should be documented for users
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"
action_id = "3fd7f8ad-2e02-44f1-8f65-8731facb1db1" # Action ID for: Generate Video from Image and Text Prompts
# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
"prompt": "GLASS style, glass face of a girl with rainbow prism glass lighting",
"numberOfFrames": 81,
"generationSteps": 30,
"videoResolution": "480p",
"guideScaleFactor": 5,
"videoAspectRatio": "16:9",
"sampleShiftFactor": 8,
"undesiredElements": "",
"generationSpeedMode": "Balanced",
"loraStrengthForClip": 1,
"loraStrengthForModel": 1
}
headers = {
"Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
"Content-Type": "application/json",
# Add any other required headers for the Cognitive Actions API
}
# Prepare the request body for the hypothetical execution endpoint
request_body = {
"action_id": action_id,
"inputs": payload
}
print(f"--- Calling Cognitive Action: {action.name or action_id} ---")
print(f"Endpoint: {COGNITIVE_ACTIONS_EXECUTE_URL}")
print(f"Action ID: {action_id}")
print("Payload being sent:")
print(json.dumps(request_body, indent=2))
print("------------------------------------------------")
try:
response = requests.post(
COGNITIVE_ACTIONS_EXECUTE_URL,
headers=headers,
json=request_body
)
response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
result = response.json()
print("Action executed successfully. Result:")
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 (non-JSON): {e.response.text}")
print("------------------------------------------------")
Conclusion
The Glass Face Vid Cognitive Actions provide a powerful solution for developers seeking to produce high-quality video content effortlessly. By leveraging the ability to generate videos from images and text prompts, you can streamline content creation, boost engagement, and explore new creative avenues. To get started, integrate this action into your projects and watch your ideas come to life through dynamic video storytelling.