Generate Stunning Images with the z1zo7/home_furnishings Cognitive Actions

22 Apr 2025
Generate Stunning Images with the z1zo7/home_furnishings Cognitive Actions

In the digital age, the ability to generate and manipulate images seamlessly can elevate applications in the home furnishings space. The z1zo7/home_furnishings Cognitive Actions offer developers a powerful toolset for creating unique images using advanced techniques like inpainting and img2img transformations. These pre-built actions simplify image generation, making it easier to bring creative concepts to life while ensuring customization and control over the output.

Prerequisites

To get started with the Cognitive Actions, you will need an API key for the platform. This key is essential for authenticating your requests. Typically, you will pass this key in the headers of your API calls to ensure secure access to the action endpoints.

Cognitive Actions Overview

Generate Image with Mask and Prompt

The Generate Image with Mask and Prompt action allows developers to create customized images based on text prompts and specific masks. This action supports various parameters such as image dimensions, refinement styles, and safety features, enabling high levels of personalization in the generated images.

  • Category: image-generation

Input

The input for this action is structured as follows:

  • mask (string, required): URI of the input mask for inpaint mode. Black areas are preserved, and white areas are inpainted.
  • seed (integer, optional): Random seed for generating deterministic results. Leave blank for random seeding.
  • image (string, required): URI of the input image for img2img or inpaint mode.
  • width (integer, optional): Width of the output image in pixels (default: 1024).
  • height (integer, optional): Height of the output image in pixels (default: 1024).
  • prompt (string, optional): Text prompt guiding image generation (default: "An astronaut riding a rainbow unicorn").
  • refineStyle (string, optional): Choose refine style (default: "no_refiner").
  • scheduleType (string, optional): Type of scheduler for denoising steps (default: "K_EULER").
  • numberOfOutputs (integer, optional): Number of images to generate (default: 1, max: 4).
  • refinementSteps (integer, optional): Number of refinement steps (defaults to inference steps).
  • highNoiseFraction (number, optional): Fraction of noise for 'expert_ensemble_refiner' (default: 0.8).
  • loraAdditiveScale (number, optional): Scale for LoRA additive adjustment (default: 0.6).
  • applyImageWatermark (boolean, optional): Enable watermark on generated images (default: true).
  • inputNegativePrompt (string, optional): Elements to avoid during generation.
  • promptInputStrength (number, optional): Strength of the prompt (default: 0.8).
  • alternateLoraWeights (string, optional): Specify alternative LoRA weights.
  • numberOfInferenceSteps (integer, optional): Total denoising steps (default: 50).
  • deactivateSafetyChecker (boolean, optional): Deactivate the safety checker (default: false).
  • classifierFreeGuidanceScale (number, optional): Scale for classifier-free guidance (default: 7.5).

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "A blue chair+Bean+Bag+Chair+Lounger",
  "refineStyle": "no_refiner",
  "scheduleType": "K_EULER",
  "numberOfOutputs": 1,
  "highNoiseFraction": 0.8,
  "loraAdditiveScale": 0.6,
  "applyImageWatermark": true,
  "promptInputStrength": 0.8,
  "numberOfInferenceSteps": 50,
  "classifierFreeGuidanceScale": 7.5
}

Output

The output of this action typically returns a URL to the generated image.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/b5ffd341-1009-4ca8-8b63-970c0c9f5df3/73a3a33c-a3f5-4040-bb36-28adcfc6a8d9.png"
]

Conceptual Usage Example (Python)

Below is a conceptual code snippet illustrating how a developer can call the action in 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 = "046e1fd9-7b2f-4774-9098-d082614d9527" # Action ID for Generate Image with Mask and Prompt

# Construct the input payload based on the action's requirements
payload = {
  "width": 1024,
  "height": 1024,
  "prompt": "A blue chair+Bean+Bag+Chair+Lounger",
  "refineStyle": "no_refiner",
  "scheduleType": "K_EULER",
  "numberOfOutputs": 1,
  "highNoiseFraction": 0.8,
  "loraAdditiveScale": 0.6,
  "applyImageWatermark": True,
  "promptInputStrength": 0.8,
  "numberOfInferenceSteps": 50,
  "classifierFreeGuidanceScale": 7.5
}

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 for generating the image is specified, and the input payload is structured based on the action's requirements. The endpoint URL is hypothetical and should be replaced with the actual endpoint for executing actions.

Conclusion

The z1zo7/home_furnishings Cognitive Actions offer a rich set of functionalities for developers looking to enhance their applications with advanced image generation capabilities. By leveraging these actions, you can create stunning visuals tailored to your requirements, streamline your creative processes, and ultimately deliver a more engaging experience for your users. Explore these options and start integrating them into your projects today!