Generate Stunning Images with lucataco/flux.1-controlnet-lineart-promeai Cognitive Actions

23 Apr 2025
Generate Stunning Images with lucataco/flux.1-controlnet-lineart-promeai Cognitive Actions

In the world of image generation, the lucataco/flux.1-controlnet-lineart-promeai offers an exciting opportunity for developers to create high-quality visuals using AI. This powerful Cognitive Action, trained on the Black-Forest-Labs/FLUX.1-dev dataset, allows you to generate images based on lineart conditions. By leveraging specific prompts and control images, you can achieve remarkable image outputs tailored to your creative needs.

Prerequisites

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

  • API Key: To access the Cognitive Actions platform, you'll need an API key. This key will be used for authentication in your API requests.
  • Basic Understanding of JSON: Familiarity with JSON structures is essential, as you'll be working with JSON payloads for input and output.

Authentication typically involves passing the API key in the request headers, which is crucial for securing your API calls.

Cognitive Actions Overview

Generate Image with FLUX.1 ControlNet Lineart

This action allows you to generate images by utilizing lineart conditions. It is particularly beneficial for artists, game developers, and content creators who want to produce unique visuals from descriptive prompts.

  • Category: Image Generation

Input

The input for this action requires a JSON object with the following fields:

  • prompt (required): A descriptive text prompt that guides the image generation. Be specific to get the desired output.
  • controlImage (required): A URI pointing to a grayscale input image that influences the generated output.
  • guidanceScale (optional): A scale factor (0.1 to 10) that determines the guidance level in image generation. The default is 3.5.
  • conditioningScale (optional): A scale factor (0.1 to 1) for conditioning information, defaulting to 0.6.
  • numberOfInferenceSteps (optional): The number of inference steps used in the generation process, ranging from 1 to 50, with a default of 28.

Example Input:

{
  "prompt": "cute anime girl with massive fluffy fennec ears and a big fluffy tail blonde messy long hair blue eyes wearing a maid outfit with a long black gold leaf pattern dress and a white apron mouth open holding a fancy black forest cake with candles on top in the kitchen of an old dark Victorian mansion lit by candlelight with a bright window to the foggy forest and very expensive stuff everywhere",
  "controlImage": "https://replicate.delivery/pbxt/LivVSbyfSS3wWTrl9Q6cvsPoAhTGrcOIEpoOpiTqZpGdf0Y9/example-control.jpg",
  "guidanceScale": 3.5,
  "conditioningScale": 0.6,
  "numberOfInferenceSteps": 28
}

Output

When the action is executed successfully, it returns a URI pointing to the generated image.

Example Output:

https://assets.cognitiveactions.com/invocations/d8bb0b96-5119-472a-bfc1-4c1b8219523d/4116af93-122f-4d5f-a200-d3a395a63d17.png

Conceptual Usage Example (Python)

Here’s how you might call the Cognitive Actions execution endpoint to generate an image:

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 = "f61a06c7-46eb-4972-bd33-a30ceec803ee" # Action ID for Generate Image with FLUX.1 ControlNet Lineart

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "cute anime girl with massive fluffy fennec ears and a big fluffy tail blonde messy long hair blue eyes wearing a maid outfit with a long black gold leaf pattern dress and a white apron mouth open holding a fancy black forest cake with candles on top in the kitchen of an old dark Victorian mansion lit by candlelight with a bright window to the foggy forest and very expensive stuff everywhere",
    "controlImage": "https://replicate.delivery/pbxt/LivVSbyfSS3wWTrl9Q6cvsPoAhTGrcOIEpoOpiTqZpGdf0Y9/example-control.jpg",
    "guidanceScale": 3.5,
    "conditioningScale": 0.6,
    "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 example, you replace the API key and endpoint with your actual values. The action_id corresponds to the "Generate Image with FLUX.1 ControlNet Lineart" action. The payload is constructed using the example input specified. This snippet demonstrates how to send a request to the Cognitive Actions service and handle the response.

Conclusion

The lucataco/flux.1-controlnet-lineart-promeai Cognitive Actions provide an exciting way to generate stunning images through AI. By utilizing descriptive prompts and control images, developers can create unique visuals tailored to their specific needs. Whether you're building games, applications, or creative projects, these actions can enhance your workflow significantly. Explore the possibilities and integrate these actions into your applications today!