Create Stunning Tofaşk Images with the ondugulsevdi/tofask Cognitive Actions

23 Apr 2025
Create Stunning Tofaşk Images with the ondugulsevdi/tofask Cognitive Actions

Integrating the ondugulsevdi/tofask API opens the door to powerful image generation capabilities, allowing developers to create high-quality images featuring the iconic Turkish Tofaş in various settings. The pre-built Cognitive Action for this API makes it easy to generate stunning visuals while capturing the classic charm of Tofaş with a modern twist. In this guide, we will explore how to effectively utilize this action to generate unique images for your applications.

Prerequisites

Before you start using the Cognitive Actions, ensure you have the following:

  • An API key for the Cognitive Actions platform to authenticate your requests.
  • Basic understanding of JSON and RESTful API concepts.

To authenticate your requests, you will typically pass your API key in the headers of your HTTP calls. This allows you to securely access the functionalities provided by the Cognitive Actions API.

Cognitive Actions Overview

Generate Tofaşk Image

Description: Create high-quality images featuring the iconic Turkish Tofaş with a modern reimagining, capturing both its classic charm and contemporary flair in diverse settings.

Category: Image Generation

Input

The input schema for this action requires the following fields:

  • prompt (required): A descriptive prompt for image generation.
  • goFast (optional): Enables faster generation.
  • numOutputs (optional): Specifies the number of images to generate.
  • outputFormat (optional): Determines the format of the output images.
  • guidanceScale (optional): Adjusts the scale of guidance used during the process.
  • outputQuality (optional): Quality level of the output images.
  • imageAspectRatio (optional): Sets the aspect ratio of the generated image.
  • numInferenceSteps (optional): Specifies the number of denoising steps.

Example Input:

{
  "goFast": true,
  "prompt": "A dark blue Tofaşk car parked in Dublin at night. The streets are wet from the rain, with neon lights reflecting off the puddles, casting colorful glows of purple, pink, and blue across the scene. The sky is overcast, with dark clouds hanging low, adding to the moody cyberpunk atmosphere. The rain continues to fall, creating a misty haze around the car, while the city’s towering buildings and flickering lights give the setting a gritty, futuristic edge. The Tofaşk, with its classic design, contrasts sharply with the modern, cyberpunk environment, standing out amidst the glowing urban landscape. high quality, 4K, professional shots, front view",
  "loraScale": 1,
  "numOutputs": 1,
  "outputFormat": "webp",
  "guidanceScale": 3,
  "outputQuality": 80,
  "inferenceModel": "dev",
  "promptStrength": 0.8,
  "imageMegapixels": "1",
  "imageAspectRatio": "1:1",
  "numInferenceSteps": 28,
  "additionalLoraScale": 1
}

Output

The action typically returns a list of URLs pointing to the generated images. Here’s an example of the output:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/cace5d20-b766-4d5f-b1b7-71bd24e0b308/7f53d5c6-f768-43f0-b566-6ad01133a362.webp"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet demonstrating how to call the Cognitive Actions execution endpoint for generating a Tofaşk 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 = "28559a92-5ad2-43af-8651-b10542a11851" # Action ID for Generate Tofaşk Image

# Construct the input payload based on the action's requirements
payload = {
    "goFast": True,
    "prompt": "A dark blue Tofaşk car parked in Dublin at night...",
    "loraScale": 1,
    "numOutputs": 1,
    "outputFormat": "webp",
    "guidanceScale": 3,
    "outputQuality": 80,
    "inferenceModel": "dev",
    "promptStrength": 0.8,
    "imageMegapixels": "1",
    "imageAspectRatio": "1:1",
    "numInferenceSteps": 28,
    "additionalLoraScale": 1
}

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}
    )
    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, replace "YOUR_COGNITIVE_ACTIONS_API_KEY" with your actual API key. The input payload is structured based on the example input provided, and the action ID corresponds to the "Generate Tofaşk Image" action.

Conclusion

The ondugulsevdi/tofask Cognitive Action provides an effortless way to generate captivating images of the Tofaş, merging nostalgia with modern aesthetics. By leveraging this action, developers can enhance their applications with unique visuals that resonate with users. Experiment with different prompts and parameters to discover the full potential of this powerful tool!