Create Stunning Blade Runner Style Images with Cognitive Actions

22 Apr 2025
Create Stunning Blade Runner Style Images with Cognitive Actions

In the realm of creative AI, the "roshansood/bladerunner" API offers developers a unique set of Cognitive Actions for generating images reminiscent of the iconic Blade Runner aesthetic. These actions utilize advanced model fine-tuning techniques to create visually captivating images. With just a few parameters, developers can tailor their creations, making it easier than ever to integrate sophisticated image generation into their applications.

Prerequisites

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

  • API Key: You will need a valid API key to authenticate your requests to the Cognitive Actions platform.
  • Environment Setup: It's advisable to have a development environment ready with access to libraries for making HTTP requests (like requests in Python).

Authentication typically involves passing your API key in the request headers to verify your identity when calling the Cognitive Actions endpoint.

Cognitive Actions Overview

Generate Blade Runner Style Images

The Generate Blade Runner Style Images action allows you to create images that replicate the visual style of Blade Runner using parameters that control various aspects of the image generation process.

  • Purpose: Generate images that evoke the unique aesthetic of Blade Runner, with customizable features like prompt strength, guidance scale, and more.
  • Category: Image Generation

Input

The action accepts a variety of parameters encapsulated in a JSON object. Here’s a breakdown of the required and optional fields based on the input schema:

{
  "width": 1024,
  "height": 1024,
  "prompt": "blade runner city",
  "loraScale": 0.6,
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "negativePrompt": "",
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "refinementStyle": "no_refiner",
  "schedulingMethod": "K_EULER",
  "highNoiseFraction": 0.8,
  "numInferenceSteps": 50
}
  • Required Fields:
    • prompt: A textual description of the desired image.
    • width: Width of the output image in pixels (default is 1024).
    • height: Height of the output image in pixels (default is 1024).
  • Optional Fields:
    • loraScale: Controls the LoRA scale for model augmentation (default is 0.6).
    • guidanceScale: Adjusts the guidance level for the generation process (default is 7.5).
    • applyWatermark: If true, a watermark will be applied to the image (default is true).
    • negativePrompt: Specify aspects to avoid in the generated image.
    • promptStrength: Determines how strongly the prompt influences the output (default is 0.8).
    • numberOfOutputs: Number of images to generate (default is 1, maximum is 4).
    • refinementStyle: Style of refinement to apply, with options including "no_refiner" (default).
    • schedulingMethod: Method for scheduling image generation steps (default is "K_EULER").
    • highNoiseFraction: Fraction of noise used during refinement (default is 0.8).
    • numInferenceSteps: Total number of denoising steps (default is 50).

Output

Upon successfully executing the action, the API typically returns a JSON response containing the generated image(s). Below is an example of the output:

[
  "https://assets.cognitiveactions.com/invocations/db73f45f-d18a-4963-80e3-72697a639cec/b011ea1d-2ef7-489c-a027-4af91617b793.png"
]

Conceptual Usage Example (Python)

Here’s how you might call the Generate Blade Runner Style Images 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 = "b9bb1e15-6e76-4fac-830b-b334cd8e1388" # Action ID for Generate Blade Runner Style Images

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "blade runner city",
    "loraScale": 0.6,
    "guidanceScale": 7.5,
    "applyWatermark": true,
    "negativePrompt": "",
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "refinementStyle": "no_refiner",
    "schedulingMethod": "K_EULER",
    "highNoiseFraction": 0.8,
    "numInferenceSteps": 50
}

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 snippet, you replace the API key and endpoint with your own. The action_id variable holds the ID for the action you want to execute, and the payload dictionary is constructed following the specifications outlined earlier.

Conclusion

The "roshansood/bladerunner" Cognitive Actions provide developers with an exceptional opportunity to integrate visually stunning image generation into their applications. By leveraging parameters that allow for fine-tuning and customization, you can create unique images that capture the essence of the Blade Runner aesthetic. Experiment with different prompts and settings to discover the full potential of this powerful tool. Happy coding!