Create Stunning Images with the nevzatsoydan Cognitive Actions

25 Apr 2025
Create Stunning Images with the nevzatsoydan Cognitive Actions

In this blog post, we'll explore the nevzatsoydan/nevzatsoydan API and its powerful Cognitive Action: Generate Image with Inpainting. This action leverages advanced image-to-image processing and inpainting techniques to create stunning, detailed images based on your specifications. By utilizing this pre-built action, developers can quickly integrate image generation capabilities into their applications, saving time and resources while enhancing user experiences.

Prerequisites

Before you dive into using the Cognitive Actions, ensure you have the following:

  • An API key for the nevzatsoydan service to authenticate your requests.
  • Familiarity with making HTTP requests and handling JSON data.

Authentication typically involves passing your API key in the headers of your requests, allowing you to securely access the action endpoints.

Cognitive Actions Overview

Generate Image with Inpainting

The Generate Image with Inpainting action allows developers to create detailed images by leveraging different models and customization options. This action is ideal for applications requiring unique visual content derived from textual prompts or existing images.

Input

The input for this action is structured as follows:

{
  "prompt": "Your descriptive prompt goes here.",
  "model": "dev",
  "loraScale": 1,
  "guidanceScale": 3.5,
  "outputQuality": 90,
  "extraLoraScale": 1,
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "imageAspectRatio": "16:9",
  "numInferenceSteps": 28,
  "outputImageFormat": "jpg"
}
  • Required Fields:
    • prompt: A text prompt guiding the image generation.
  • Optional Fields:
    • model: Selects the inference model, either dev or schnell.
    • loraScale: Adjusts the intensity of the primary LoRA application.
    • guidanceScale: Sets the guidance scale for the diffusion process.
    • outputQuality: Determines image quality on a scale from 0 to 100.
    • extraLoraScale: Specifies the intensity of the extra LoRA application.
    • promptStrength: Controls the strength of the prompt in image generation.
    • numberOfOutputs: Specifies how many images to generate.
    • imageAspectRatio: Defines the aspect ratio of the generated image.
    • numInferenceSteps: Sets the number of denoising steps for image creation.
    • outputImageFormat: Chooses the output format (webp, jpg, png).

Example Input

Here’s an example input payload:

{
  "model": "dev",
  "prompt": "nevzatsoydan: Here’s the English prompt for the image:\n\n“A charismatic and handsome Nevzat Soydan performing on stage in a black tuxedo, holding a microphone, with a 20-piece Turkish ensemble of saz players and 10 violinists in the background. The scene captures his elegant presence as he captivates the audience with his performance.”",
  "loraScale": 1,
  "guidanceScale": 3.5,
  "outputQuality": 90,
  "extraLoraScale": 1,
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "imageAspectRatio": "16:9",
  "numInferenceSteps": 28,
  "outputImageFormat": "jpg"
}

Output

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

[
  "https://assets.cognitiveactions.com/invocations/15b0825a-797f-4ebb-8eed-8c7383d4c17f/85c145b5-5c7d-4de0-8dde-873d46659f47.jpg"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet that demonstrates how to call the Generate Image with Inpainting 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 = "155c9920-3348-4c64-b1d2-a4d7b68f936b" # Action ID for Generate Image with Inpainting

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "nevzatsoydan: Here’s the English prompt for the image:\n\n“A charismatic and handsome Nevzat Soydan performing on stage in a black tuxedo, holding a microphone, with a 20-piece Turkish ensemble of saz players and 10 violinists in the background. The scene captures his elegant presence as he captivates the audience with his performance.”",
    "loraScale": 1,
    "guidanceScale": 3.5,
    "outputQuality": 90,
    "extraLoraScale": 1,
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "imageAspectRatio": "16:9",
    "numInferenceSteps": 28,
    "outputImageFormat": "jpg"
}

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 YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key, and the payload is constructed based on the action's requirements. The endpoint URL and request structure are illustrative and should be adapted to match the actual API documentation.

Conclusion

The nevzatsoydan/nevzatsoydan Cognitive Actions provide a robust solution for generating high-quality images through advanced inpainting techniques. By following the guidelines outlined in this post, developers can easily integrate these capabilities into their applications, enabling creative and customized visual content generation.

As you explore these actions further, consider various use cases such as content creation, digital art, and interactive applications. Happy coding!