Create Stunning Marble Statue Style Images with secerbel/flux-statue Cognitive Actions

Integrating advanced image generation capabilities into your applications has never been easier with the secerbel/flux-statue API. This powerful API offers a unique Cognitive Action designed specifically for generating images that mimic the exquisite style of ancient Roman and Greek marble statues. By leveraging the computing power of Nvidia H100 GPUs, you can create stunning visuals with varying complexity and speeds.
In this guide, we’ll explore how to utilize the Generate Marble Statue Style Image action, detailing the input requirements, expected output, and providing a conceptual usage example in Python.
Prerequisites
Before you can start using the Cognitive Actions, ensure you have the following:
- An API key for the secerbel/flux-statue service.
- Basic understanding of JSON and HTTP requests.
- Familiarity with Python for executing the provided code snippets.
Authentication typically involves passing your API key in the request headers, allowing you to securely interact with the Cognitive Actions.
Cognitive Actions Overview
Generate Marble Statue Style Image
The Generate Marble Statue Style Image action allows you to create images that resemble the timeless beauty of marble statues. This action is categorized under image-generation, making it ideal for applications that require artistic image rendering.
Input
The action requires a well-structured input JSON based on the following schema. Here's a breakdown of the required and optional fields:
- Required:
prompt: A descriptive text prompt for the desired image (e.g., "a bust of TOK in white marble").
- Optional:
model: Specifies the model used for inference (devorschnell).outputFormat: The format of the output image (e.g.,webp,jpg,png).guidanceScale: Influences the style adherence during image generation.numberOfOutputs: Specifies how many images to generate.promptIntensity: Strength of the prompt in image-to-image mode.imageAspectRatio: Defines the desired aspect ratio of the generated image, with options like1:1,16:9, etc.imageOutputQuality: The quality of the output image, ranging from 0 (lowest) to 100 (highest).
Here’s an example of a JSON payload that you can use to invoke this action:
{
"model": "dev",
"prompt": "a bust of TOK in white marble",
"outputFormat": "webp",
"guidanceScale": 2,
"numberOfOutputs": 1,
"promptIntensity": 0.8,
"imageAspectRatio": "1:1",
"imageOutputQuality": 90,
"additionalLoraScale": 1,
"loraApplicationScale": 1,
"numberOfInferenceSteps": 28
}
Output
Upon successful execution, the action typically returns a URL pointing to the generated image. Here’s an example of what you might receive:
[
"https://assets.cognitiveactions.com/invocations/b1e2e49e-ef42-4f6a-984e-6e1d14f1ba2a/41b2d803-545e-4b71-9b8b-a56935b8f40a.webp"
]
This URL can be used to access the generated image directly.
Conceptual Usage Example (Python)
To utilize the Generate Marble Statue Style Image action in your application, you can use the following Python code snippet. Ensure you replace the placeholders with your actual API key and action ID.
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 = "5007f553-4873-4dd5-91a9-588203cd33c7" # Action ID for Generate Marble Statue Style Image
# Construct the input payload based on the action's requirements
payload = {
"model": "dev",
"prompt": "a bust of TOK in white marble",
"outputFormat": "webp",
"guidanceScale": 2,
"numberOfOutputs": 1,
"promptIntensity": 0.8,
"imageAspectRatio": "1:1",
"imageOutputQuality": 90,
"additionalLoraScale": 1,
"loraApplicationScale": 1,
"numberOfInferenceSteps": 28
}
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}
)
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, you specify the action ID and construct the input JSON payload according to the action's requirements. The response will contain the URL of the generated image.
Conclusion
The Generate Marble Statue Style Image action from the secerbel/flux-statue API offers an exciting opportunity to create unique and artistic images in the style of ancient marble sculptures. With just a few lines of code, you can enhance your applications with visually stunning content.
Explore various prompts and settings to discover the full potential of this action and consider integrating it into your next project to captivate your users with artistic visuals!