Transform Your Images with Giza Life Style Cognitive Actions

23 Apr 2025
Transform Your Images with Giza Life Style Cognitive Actions

In the world of digital content creation, the ability to generate stunning images can significantly enhance the user experience. The Giza Life Style Cognitive Actions empower developers to seamlessly integrate advanced image generation capabilities into their applications. By harnessing the power of pre-built actions, you can create high-quality, customized images optimized for various use cases, from fashion to artistic projects.

Prerequisites

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

  • An API key for the Cognitive Actions platform.
  • Basic knowledge of JSON and Python for making API requests.

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

Cognitive Actions Overview

Generate Image with Inpainting

The Generate Image with Inpainting action allows you to create images using advanced models while offering options for inpainting, custom dimensions, and various aspect ratios. This action is particularly useful for generating high-fashion or studio-style photoshoots.

Input

The input schema requires a JSON object with the following key properties:

  • prompt (required): A detailed textual description of the image you want to generate.
  • model: Choose between "dev" and "schnell" models for different performance characteristics.
  • width & height: Specify dimensions for the image if using a custom aspect ratio (ignored if using a mask or input image).
  • mask: (optional) URI of a mask image for inpainting.
  • image: (optional) URI of an input image for image-to-image generation.
  • seed: (optional) Integer for reproducible results.
  • guidanceScale: (optional) Scale factor for guidance during image generation.
  • imageFormat: (optional) Output format for the generated image (default is "webp").
  • outputCount: (optional) The total number of images to generate (maximum of 4).
  • imageQuality: (optional) Defines the quality of the saved output images.
  • speedOptimized: (optional) Boolean for enabling faster predictions.

Here’s an example of a valid input payload:

{
  "seed": -3,
  "model": "dev",
  "prompt": "A photo of GIZAL1. A high-fashion studio photoshoot with a minimalistic white backdrop, featuring model_blonde_fair_skin, reclining effortlessly on a Leather_Sling_Chair. The model has platinum blonde, slicked-back hair, a porcelain-fair complexion, high cheekbones, and piercing light blue eyes, giving an intense yet sophisticated expression...",
  "loraScale": 1,
  "megapixels": "1",
  "imageFormat": "jpg",
  "outputCount": 1,
  "imageQuality": 80,
  "guidanceScale": 3,
  "denoisingSteps": 28,
  "speedOptimized": false,
  "promptIntensity": 0.8,
  "imageAspectRatio": "4:5",
  "additionalLoraScale": 1
}

Output

The action typically returns a URL to the generated image. Here’s an example of a successful output:

[
  "https://assets.cognitiveactions.com/invocations/e4f6909b-5748-4953-9ed9-48a0cf3366b0/5b87d532-e117-4739-ade2-bb878d799f50.jpg"
]

Conceptual Usage Example (Python)

Here's a conceptual Python snippet demonstrating how to invoke the Generate Image with Inpainting 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 = "293cd057-32d9-4bdb-922d-6ec98cf58d52"  # Action ID for Generate Image with Inpainting

# Construct the input payload based on the action's requirements
payload = {
    "seed": -3,
    "model": "dev",
    "prompt": "A photo of GIZAL1. A high-fashion studio photoshoot with a minimalistic white backdrop...",
    "loraScale": 1,
    "megapixels": "1",
    "imageFormat": "jpg",
    "outputCount": 1,
    "imageQuality": 80,
    "guidanceScale": 3,
    "denoisingSteps": 28,
    "speedOptimized": False,
    "promptIntensity": 0.8,
    "imageAspectRatio": "4:5",
    "additionalLoraScale": 1
}

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, you will replace the YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. It constructs the input JSON payload based on the action's requirements and prints the generated image URL when successful.

Conclusion

The Giza Life Style Cognitive Actions offer powerful capabilities for image generation that can dramatically enhance your applications. With fine-tuned control over various parameters, developers can create customized images that meet specific artistic and functional criteria. Explore these actions today to elevate your digital content creations!