Create Stunning Images with veryvanya/flux-ps1-style Cognitive Actions

24 Apr 2025
Create Stunning Images with veryvanya/flux-ps1-style Cognitive Actions

In the realm of digital content creation, generating unique and captivating images can significantly enhance user engagement. The veryvanya/flux-ps1-style Cognitive Actions provide developers with robust tools to create images in the distinctive Flux lora style, leveraging text prompts typical of classic PS1 game screenshots. With customizable settings for aspect ratios, image quality, and various output formats, these pre-built actions streamline the image generation process, allowing developers to focus on creativity rather than complexity.

Prerequisites

To utilize the Cognitive Actions for image generation, developers will need:

  • API Key: Obtain an API key from the Cognitive Actions platform.
  • Setup: Ensure that you have the necessary libraries installed, such as requests for making API calls.

Authentication is typically achieved by including the API key in the request headers when invoking the actions.

Cognitive Actions Overview

Generate Flux Style Image

The Generate Flux Style Image action allows users to produce images reflective of the Flux lora style based on a text prompt. This action is particularly useful for generating nostalgic visuals reminiscent of early gaming graphics.

Input

The required input for this action includes the following fields:

  • prompt (string): A descriptive prompt for the image generation (e.g., "ps1 game screenshot, a little strawberry hamster floating on a large green leaf on a gentle river").

Optional fields include:

  • mask (string): An image mask URL for inpainting.
  • seed (integer): A random seed for reproducible generation.
  • image (string): An input image URL for image-to-image or inpainting mode.
  • model (string): Select "dev" or "schnell" for inference.
  • width (integer): Width of the generated image (when aspect ratio is custom).
  • height (integer): Height of the generated image (when aspect ratio is custom).
  • aspectRatio (string): Determine the aspect ratio (default is "1:1").
  • outputFormat (string): Specify output format (default is "webp").
  • guidanceScale (number): Set the guidance scale for the diffusion process (default is 3).
  • outputQuality (integer): Quality of the saved outputs, from 0 to 100 (default is 80).
  • numberOfOutputs (integer): Number of images to generate (default is 1).
  • numInferenceSteps (integer): Number of denoising steps (default is 28).
  • disableImageSafetyChecker (boolean): Option to disable the safety checker (default is false).

Example Input:

{
  "model": "dev",
  "prompt": "ps1 game screenshot, a little strawberry hamster floating on a large green leaf on a gentle river",
  "loraScale": 1,
  "aspectRatio": "1:1",
  "outputFormat": "webp",
  "guidanceScale": 3.5,
  "outputQuality": 80,
  "numberOfOutputs": 1,
  "numInferenceSteps": 28
}

Output

The action typically returns a URL link to the generated image. For example:

[
  "https://assets.cognitiveactions.com/invocations/73814902-aec2-4d64-907f-10f822e23485/a5548501-3643-44e8-854d-b8d82edcac79.webp"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python snippet demonstrating how to invoke the Generate Flux Style Image 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 = "acf6f927-dbcf-46d7-b643-327d28afad58"  # Action ID for Generate Flux Style Image

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "ps1 game screenshot, a little strawberry hamster floating on a large green leaf on a gentle river",
    "loraScale": 1,
    "aspectRatio": "1:1",
    "outputFormat": "webp",
    "guidanceScale": 3.5,
    "outputQuality": 80,
    "numberOfOutputs": 1,
    "numInferenceSteps": 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 code snippet, you need to replace the COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload is structured according to the input requirements, and the action ID is specified to execute the desired action.

Conclusion

The veryvanya/flux-ps1-style Cognitive Actions equip developers with powerful tools to generate visually stunning images with ease. By leveraging customizable parameters, you can create unique visuals that resonate with users and enhance your applications. Consider exploring various prompts and settings to unlock the full potential of these actions in your projects!