Generate Stunning Images Effortlessly with 0xrinegade/pible Cognitive Actions

23 Apr 2025
Generate Stunning Images Effortlessly with 0xrinegade/pible Cognitive Actions

In the realm of AI-driven creativity, the 0xrinegade/pible Cognitive Actions provide powerful tools for developers looking to integrate image generation capabilities into their applications. With the ability to create custom images tailored to specific prompts and settings, these actions leverage advanced models to produce high-quality results. Ideal for artists, marketers, and developers alike, these pre-built actions simplify the process of generating unique visual content.

Prerequisites

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

  • An API key for the Cognitive Actions platform.
  • Basic understanding of JSON and HTTP requests.
  • A setup to make HTTP calls, such as Python with the requests library.

For authentication, you will typically pass your API key in the request headers.

Cognitive Actions Overview

Generate Custom Image

The Generate Custom Image action allows developers to create images based on custom prompts and settings. It supports various modes, including inpainting and image-to-image generation, enabling greater flexibility and creativity.

  • Category: Image Generation
  • Purpose: Generate images using customizable parameters such as resolution, aspect ratio, and guidance scale.

Input

The input schema consists of several fields, with prompt being a required field. Here’s a breakdown of the input properties:

  • prompt (string): The textual prompt for generating the image (required).
  • image (string): URI for the input image (optional, used in image-to-image mode).
  • mask (string): URI for the image mask (optional, used in inpainting mode).
  • width (integer): Specifies the image width (optional, effective if aspect_ratio is 'custom').
  • height (integer): Specifies the image height (optional, effective if aspect_ratio is 'custom').
  • goFast (boolean): Enables faster predictions (optional).
  • numOutputs (integer): Number of images to generate (default: 1).
  • guidanceScale (number): Influences realism during the diffusion process (default: 3).
  • outputQuality (integer): Image quality when saving outputs (default: 80).
  • modelSelection (string): Choose between 'dev' or 'schnell' models (default: 'dev').

Here’s an example input JSON payload:

{
  "image": "https://replicate.delivery/pbxt/M7YQADZSTN8kfjTEhKLLluULiZIcnyiVKgv1NLOkPB4uhljp/S1H4J72DSRBXQ1YA8VFNYBWGC0.jpeg",
  "goFast": true,
  "prompt": "pixardio in tokyo TOK",
  "loraScale": 1.48,
  "numOutputs": 4,
  "guidanceScale": 2.05,
  "outputQuality": 88,
  "modelSelection": "schnell"
}

Output

The output returns an array of image URLs generated based on the input parameters. Here’s an example of what the output might look like:

[
  "https://assets.cognitiveactions.com/invocations/13d6873e-7d18-4a78-9619-b1f15e0d0154/8b55a5fa-fe7f-4ef4-a9cb-b7ccb5563680.webp",
  "https://assets.cognitiveactions.com/invocations/13d6873e-7d18-4a78-9619-b1f15e0d0154/1661590c-6756-4893-b7a1-8e1e06643ce3.webp",
  "https://assets.cognitiveactions.com/invocations/13d6873e-7d18-4a78-9619-b1f15e0d0154/ea147dea-1f6c-4ee8-aaa8-6cba74f90edb.webp",
  "https://assets.cognitiveactions.com/invocations/13d6873e-7d18-4a78-9619-b1f15e0d0154/f7065c8d-e665-40b1-8c38-d4fd64108c28.webp"
]

Conceptual Usage Example (Python)

Here’s how a developer might call this action using Python:

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 = "0f08f85d-2d94-42dd-ab5d-f33468d88af1"  # Action ID for Generate Custom Image

# Construct the input payload based on the action's requirements
payload = {
    "image": "https://replicate.delivery/pbxt/M7YQADZSTN8kfjTEhKLLluULiZIcnyiVKgv1NLOkPB4uhljp/S1H4J72DSRBXQ1YA8VFNYBWGC0.jpeg",
    "goFast": True,
    "prompt": "pixardio in tokyo TOK",
    "loraScale": 1.48,
    "numOutputs": 4,
    "guidanceScale": 2.05,
    "outputQuality": 88,
    "modelSelection": "schnell"
}

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 replace the API key and endpoint with your actual credentials. The input payload is structured based on the required fields of the Generate Custom Image action. The response is processed to extract the generated image URLs.

Conclusion

The 0xrinegade/pible Cognitive Actions offer a straightforward way to integrate advanced image generation into your applications. By leveraging the Generate Custom Image action, developers can create stunning custom images tailored to specific prompts and settings. The possibilities are vast, from generating artwork to creating marketing visuals. Start experimenting with these actions today and unleash your creative potential!