Unlock Creative Image Generation with Zeke/Transamerica Pyramid Cognitive Actions

24 Apr 2025
Unlock Creative Image Generation with Zeke/Transamerica Pyramid Cognitive Actions

The Zeke/Transamerica Pyramid API offers developers a powerful tool for generating high-quality, fine-tuned images, particularly of the iconic Transamerica Pyramid building in San Francisco. By leveraging advanced image generation techniques, including Flux fine-tuning, developers can create custom images with various specifications tailored to their applications. In this article, we'll explore how to utilize the provided Cognitive Action to generate stunning images, including its input requirements and conceptual usage in Python.

Prerequisites

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

  • An API key for accessing the Cognitive Actions platform.
  • Familiarity with JSON structures for input and output handling.
  • Basic knowledge of HTTP requests for interacting with APIs.

Authentication typically involves including your API key in the request headers, allowing your application to securely access the Cognitive Actions endpoints.

Cognitive Actions Overview

Generate Fine-Tuned Image of Transamerica Pyramid

This action generates a fine-tuned image of the Transamerica Pyramid, utilizing advanced techniques for customization such as aspect ratios, dimensions, and additional enhancements through LoRA weights.

Input

The following fields are required and optional for the input schema:

  • prompt (required): Text prompt for image generation. Example: "The zeke/transamerica-pyramid Transamerica building in San Francisco. 'the emperor' in the style of TOK a trtcrd, tarot style".
  • model (optional): Specifies the inference model. Options include "dev" (recommended) and "schnell".
  • width (optional): Width of the generated image in pixels (e.g., 832).
  • height (optional): Height of the generated image in pixels (e.g., 1440).
  • goFast (optional): Boolean to enable fast generation (default is false).
  • aspectRatio (optional): Defines the aspect ratio for the output image (default is 1:1).
  • numberOfOutputs (optional): Quantity of images to generate (default is 1, max is 4).

Here’s how the input JSON payload looks:

{
  "model": "dev",
  "width": 832,
  "goFast": false,
  "height": 1440,
  "prompt": "The zeke/transamerica-pyramid Transamerica building in San Francisco. \"the emperor\" in the style of TOK a trtcrd, tarot style",
  "extraLora": "apolinario/flux-tarot-v1",
  "megapixels": "1",
  "aspectRatio": "custom",
  "guidanceScale": 3.5,
  "mainLoraScale": 1,
  "formatOfOutput": "webp",
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "qualityOfOutput": 100,
  "additionalLoraScale": 1,
  "numberOfInferenceSteps": 28
}

Output

Upon execution, this action typically returns a link to the generated image. For example:

[
  "https://assets.cognitiveactions.com/invocations/0ef8ac1a-32f6-450a-9600-4df16c64500d/96b06ec6-74a4-4ecf-830a-1026c25011e8.webp"
]

This URL points to the generated image file, which can be used directly in your application.

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet demonstrating how to call the Cognitive 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 = "877e5dc8-0bea-491b-8d73-97fd5e71f119"  # Action ID for Generate Fine-Tuned Image of Transamerica Pyramid

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "width": 832,
    "goFast": False,
    "height": 1440,
    "prompt": "The zeke/transamerica-pyramid Transamerica building in San Francisco. \"the emperor\" in the style of TOK a trtcrd, tarot style",
    "extraLora": "apolinario/flux-tarot-v1",
    "megapixels": "1",
    "aspectRatio": "custom",
    "guidanceScale": 3.5,
    "mainLoraScale": 1,
    "formatOfOutput": "webp",
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "qualityOfOutput": 100,
    "additionalLoraScale": 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}  # 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, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID and input payload are structured to align with the Cognitive Action's requirements.

Conclusion

The Zeke/Transamerica Pyramid Cognitive Action provides developers with a versatile tool for creating stunning images tailored to specific needs. By understanding the input parameters and utilizing the conceptual Python example, developers can seamlessly integrate this functionality into their applications. Consider exploring various prompts and configurations to fully leverage the capabilities of this action, and unlock your creative potential in image generation!