Create Stunning Images with Deliberate V4 Image Generation

26 Apr 2025
Create Stunning Images with Deliberate V4 Image Generation

Deliberate V4 is a powerful image generation model that enables developers to create visually stunning images from text prompts or existing images. With its advanced capabilities, this service simplifies the process of generating artwork, designs, and visual content, making it an invaluable tool for creative projects. Whether you're looking to produce original artwork, enhance existing images, or perform inpainting tasks, Deliberate V4 provides the flexibility and control needed to bring your ideas to life.

The benefits of using Deliberate V4 are manifold. It not only speeds up the content creation process but also enhances creativity by allowing developers to explore various visual interpretations of prompts. Common use cases include generating unique illustrations for articles, creating concept art for games, or even designing marketing materials. By leveraging the capabilities of Deliberate V4, developers can focus on their core tasks while relying on AI to handle the intricate details of image generation.

Before diving into the functionality of Deliberate V4, ensure you have a Cognitive Actions API key and a basic understanding of how to make API calls.

Generate Images Using Deliberate V4

The Generate Images Using Deliberate V4 action is designed to create images based on text prompts, existing images, or through inpainting techniques. This action supports various functionalities, including text-to-image generation, image-to-image transformation, and inpainting, while providing enhanced control over image dimensions, scheduler algorithms, and adherence to prompts.

Input Requirements

To utilize this action, you will need to provide the following inputs:

  • prompt: A descriptive text that guides the image generation (default: "semi-transparent body, interconnected lifeforms").
  • image: A URI of the input image for image-to-image or inpainting modes (required for those modes).
  • mask: An optional URI of a mask image used in inpainting mode.
  • width: Desired width of the output image in pixels (default: 512, max: 1920).
  • height: Desired height of the output image in pixels (default: 728, max: 1920).
  • strength: A number from 0 to 1 indicating the influence of the prompt (default: 1).
  • scheduler: The algorithm used during image generation (default: "K_EULER_ANCESTRAL").
  • guidanceScale: A scale factor for guidance from 0 to 10 (default: 7.5).
  • negativePrompt: Text to guide the generator away from unwanted features (default: a list of undesirable traits).
  • useKarrasSigmas: A boolean to determine whether to use Karras sigmas (default: false).
  • numInferenceSteps: Total steps for the inference process (default: 20, max: 100).

Expected Output

The output of this action is a URI pointing to the generated image, providing a seamless way to retrieve and display the created content.

Use Cases for this specific action:

  • Creative Projects: Generate unique illustrations for blogs, articles, or social media posts.
  • Game Development: Create concept art or assets that reflect specific themes or ideas.
  • Marketing: Design promotional materials with custom visuals that stand out.
  • Artistic Exploration: Experiment with different prompts and styles to inspire new creative directions.
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 = "4f134904-7c57-4e51-80f1-fc61f7d464f7" # Action ID for: Generate Images Using Deliberate V4

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "width": 512,
  "height": 728,
  "prompt": "semi-transparent body, interconnected lifeforms",
  "strength": 1,
  "scheduler": "K_EULER_ANCESTRAL",
  "guidanceScale": 7.5,
  "negativePrompt": "[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry",
  "useKarrasSigmas": false,
  "numInferenceSteps": 20
}

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("------------------------------------------------")

In conclusion, Deliberate V4 offers a versatile solution for image generation that caters to a wide range of creative needs. Its ability to generate images from both text prompts and existing images, combined with customizable parameters, allows developers to unleash their creativity without the constraints of traditional design tools. By integrating Deliberate V4 into your projects, you can enhance your workflows, produce high-quality visuals, and ultimately elevate the impact of your creative endeavors. Explore the possibilities today and see how Deliberate V4 can transform your approach to image generation!