Create Stunning Custom Dog Images with the Sundai Club's Cognitive Actions

23 Apr 2025
Create Stunning Custom Dog Images with the Sundai Club's Cognitive Actions

In the world of AI-driven content creation, the sundai-club/umang_dog API offers developers an exciting toolset for generating unique and high-quality images of dogs. Leveraging advanced machine learning models, this API provides a simple way to create tailored visuals based on user-defined prompts and parameters. Whether you're looking to enhance a pet-related app or create marketing materials, these pre-built Cognitive Actions can save you time and effort while delivering impressive results.

Prerequisites

Before diving into the integration of Cognitive Actions, ensure you have the following:

  • API Key: You will need an API key for authentication when accessing the Cognitive Actions platform.
  • Environment Setup: Make sure your development environment is ready to send HTTP requests, and you have the requests library available if you're using Python.

To authenticate your requests, you’ll typically send the API key in the headers of your HTTP requests. Here’s a conceptual overview:

headers = {
    "Authorization": f"Bearer {YOUR_API_KEY}",
    "Content-Type": "application/json"
}

Cognitive Actions Overview

Generate Custom Dog Images

Description: This action allows you to create high-quality, customized images of dogs using a fine-tuned model. It offers a variety of parameters to personalize your outputs, ensuring that the generated images meet your specific needs.

Category: Image Generation

Input

The input for this action requires a JSON object with multiple fields, including required and optional parameters. Here’s a breakdown:

  • Required Fields:
    • prompt: A string that describes the desired image of the dog.
  • Optional Fields:
    • mask: Image mask for image inpainting mode (URI format).
    • seed: Integer for reproducibility of the output (e.g., 5000).
    • image: Input image for transformation (URI format).
    • width: Integer to set the width of the generated image (between 256 and 1440).
    • height: Integer to set the height of the generated image (between 256 and 1440).
    • goFast: Boolean to enable optimized speed (default: false).
    • aspectRatio: String to define the aspect ratio (default: 1:1).
    • outputFormat: The format for the generated images (default: webp).
    • guidanceScale: A number to adjust the guidance scale for the diffusion process (default: 3).
    • Additional parameters like numOutputs, numInferenceSteps, and others to fine-tune the output.

Example Input:

{
  "seed": 5000,
  "goFast": false,
  "prompt": "MITHOO the 4-legged dog is in a playground, rolling in the grass, while his family watches from a park bench nearby",
  "loraScale": 1,
  "numOutputs": 1,
  "aspectRatio": "1:1",
  "outputFormat": "webp",
  "guidanceScale": 6.4,
  "outputQuality": 80,
  "extraLoraScale": 1,
  "inferenceModel": "dev",
  "promptStrength": 0.51,
  "imageResolution": "1",
  "numInferenceSteps": 28
}

Output

The output will typically be a JSON object containing URLs to the generated images. Here’s an example of what you might receive:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/0bef69bb-059f-46c1-905d-96aa13876c6c/51546a37-26a8-41d3-a175-095b30f76bbd.webp"
]

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet demonstrating how to execute the Generate Custom Dog Images 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 = "0ef574a5-fc46-4487-a8f6-7c63dbfbb35e" # Action ID for Generate Custom Dog Images

# Construct the input payload based on the action's requirements
payload = {
    "seed": 5000,
    "goFast": False,
    "prompt": "MITHOO the 4-legged dog is in a playground, rolling in the grass, while his family watches from a park bench nearby",
    "loraScale": 1,
    "numOutputs": 1,
    "aspectRatio": "1:1",
    "outputFormat": "webp",
    "guidanceScale": 6.4,
    "outputQuality": 80,
    "extraLoraScale": 1,
    "inferenceModel": "dev",
    "promptStrength": 0.51,
    "imageResolution": "1",
    "numInferenceSteps": 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} # 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 code snippet, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action_id corresponds to the Generate Custom Dog Images action. The payload is constructed based on the required and optional fields specified earlier. The API call is made using the requests library, and the response is printed out.

Conclusion

The sundai-club/umang_dog Cognitive Actions empower developers to seamlessly integrate custom dog image generation into their applications. With the ability to customize parameters such as aspect ratio, image quality, and prompt details, these actions provide a versatile solution for a variety of use cases. Start experimenting with these actions today to bring your creative ideas to life!