Create Stunning Studio Ghibli Style Landscapes with Cognitive Actions

In the world of digital creativity, the ability to generate captivating visuals can set your application apart. The mohamm-ad/sdxl-studioghibli spec offers a powerful Cognitive Action that allows developers to leverage a fine-tuned Stable Diffusion model, specifically trained on Studio Ghibli landscape images. This action empowers users to create stunning visuals with customizable parameters, providing a unique way to integrate enchanting imagery into your applications.
Prerequisites
Before diving into the integration of the Cognitive Actions, ensure that you have:
- An API key for the Cognitive Actions platform.
- Familiarity with making HTTP requests and handling JSON payloads.
Authentication typically involves passing your API key in the request headers, ensuring secure access to the service.
Cognitive Actions Overview
Generate Studio Ghibli Style Landscapes
Description:
This action utilizes a fine-tuned Stable Diffusion model to generate stunning landscape visuals inspired by the iconic Studio Ghibli style. You can customize various parameters like image size, prompt intensity, and guidance scale to create unique outputs.
Category: Image Generation
Input
The input schema for this action is defined as follows:
{
"mask": "string",
"seed": "integer",
"image": "string",
"width": "integer",
"height": "integer",
"prompt": "string",
"refine": "string",
"scheduler": "string",
"layerScale": "number",
"loraWeights": "string",
"promptPower": "number",
"negationPrompt": "string",
"numberOfOutputs": "integer",
"includeWatermark": "boolean",
"guidanceIntensity": "number",
"highNoiseFraction": "number",
"numberOfRefineSteps": "integer",
"numberOfInferenceSteps": "integer",
"deactivateSafetyChecker": "boolean"
}
Example Input:
{
"width": 1024,
"height": 1024,
"prompt": "In the style of Studio Ghibli, a view of the Golden Gate Bridge",
"refine": "no_refiner",
"scheduler": "K_EULER",
"layerScale": 0.6,
"promptPower": 0.8,
"numberOfOutputs": 1,
"includeWatermark": true,
"guidanceIntensity": 7.5,
"highNoiseFraction": 0.8,
"numberOfInferenceSteps": 50
}
Output
The action returns an array of image URLs representing the generated landscapes. Here’s an example of the output:
[
"https://assets.cognitiveactions.com/invocations/fb0bc5a4-ab0a-4619-ad75-a34dc5eb38d9/a0c3456e-f9e5-4788-a596-da805f7c02ef.png"
]
Conceptual Usage Example (Python)
Here's a conceptual Python code snippet demonstrating how to call this action:
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 = "b1d0d289-5917-4809-b0ca-3692acbdfa1b" # Action ID for Generate Studio Ghibli Style Landscapes
# Construct the input payload based on the action's requirements
payload = {
"width": 1024,
"height": 1024,
"prompt": "In the style of Studio Ghibli, a view of the Golden Gate Bridge",
"refine": "no_refiner",
"scheduler": "K_EULER",
"layerScale": 0.6,
"promptPower": 0.8,
"numberOfOutputs": 1,
"includeWatermark": True,
"guidanceIntensity": 7.5,
"highNoiseFraction": 0.8,
"numberOfInferenceSteps": 50
}
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, the code constructs a request to generate a Studio Ghibli style landscape. The action ID and the input payload are structured correctly to ensure the action executes as intended.
Conclusion
The mohamm-ad/sdxl-studioghibli Cognitive Action provides a fantastic opportunity for developers to create beautiful, customized Studio Ghibli style landscapes effortlessly. By integrating this action into your applications, you can enrich user experiences with captivating visuals. Consider exploring different prompt combinations and parameters to discover the full potential of this action! Happy coding!