Create Stunning Images with the PhotoDaddy Cognitive Actions

22 Apr 2025
Create Stunning Images with the PhotoDaddy Cognitive Actions

In the world of image generation, the marcodemutiis/photodaddy API offers a powerful toolset for developers looking to create unique images of "Photo Daddies". This set of Cognitive Actions allows you to generate images based on customizable prompts, inspired by the dynamic photography styles seen in games like GTA V. By leveraging these pre-built actions, you can easily integrate high-quality image generation capabilities into your applications, enhancing user engagement and creativity.

Prerequisites

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

  • An API key for the Cognitive Actions platform. This key will be used to authenticate your requests.
  • Familiarity with making HTTP requests in your programming environment of choice.

Generally, authentication is implemented by including the API key in the request headers, allowing you to securely access the available actions.

Cognitive Actions Overview

Generate Photo Daddies

Purpose: This action allows you to create images of "Photo Daddies" using a fine-tuned model. You can customize prompts to generate characters in various photography scenarios, making it a versatile tool for developers.

Category: Image Generation

Input

The input for this action consists of several fields that allow you to customize the image generation process. Here’s the schema and an example input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "a photographer PhotoDaddy underwater",
  "refine": "no_refiner",
  "loraScale": 0.6,
  "scheduler": "K_EULER",
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "inferenceSteps": 50,
  "negativePrompt": "",
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "highNoiseFraction": 0.8
}
  • width (integer): Width of the output image in pixels. Defaults to 1024.
  • height (integer): Height of the output image in pixels. Defaults to 1024.
  • prompt (string): Text prompt guiding image generation. Defaults to "An astronaut riding a rainbow unicorn".
  • refine (string): Select the refining style. Options include "no_refiner", "expert_ensemble_refiner", or "base_image_refiner".
  • loraScale (number): Scale factor for LoRA, ranges from 0 to 1.
  • scheduler (string): Select the scheduler policy for process control.
  • guidanceScale (number): Classifier-free guidance scale, ranges from 1 to 50.
  • applyWatermark (boolean): Enable watermark on generated images for traceability.
  • inferenceSteps (integer): Total number of denoising steps, ranging from 1 to 500.
  • negativePrompt (string): A negative text prompt to counter undesired concepts.
  • promptStrength (number): Effectiveness of the prompt in img2img/inpaint modes, ranging from 0 to 1.
  • numberOfOutputs (integer): Total number of images to generate, defaults to 1 (maximum of 4).
  • highNoiseFraction (number): Fraction of noise applied for 'expert_ensemble_refiner'.

Output

The action typically returns a link to the generated image. Here’s an example output:

[
  "https://assets.cognitiveactions.com/invocations/251b3458-e744-4cb0-9ac4-67e9e2dc965a/efe8d2b9-e486-4449-9f8f-323ca595e48b.png"
]

This URL points to the generated image of the "Photo Daddy".

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet illustrating how to call the Cognitive Actions execution endpoint:

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 = "f996587f-36ba-49d1-bacd-b3b104890b87"  # Action ID for Generate Photo Daddies

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "a photographer PhotoDaddy underwater",
    "refine": "no_refiner",
    "loraScale": 0.6,
    "scheduler": "K_EULER",
    "guidanceScale": 7.5,
    "applyWatermark": True,
    "inferenceSteps": 50,
    "negativePrompt": "",
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "highNoiseFraction": 0.8
}

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, you replace the placeholder with your actual API key and the endpoint, then structure the payload according to the action's input schema. The action ID corresponds to the "Generate Photo Daddies" action.

Conclusion

The marcodemutiis/photodaddy Cognitive Actions provide developers with an exciting opportunity to create unique images tailored to specific prompts. By integrating these actions, you can enhance your applications with engaging visual content, opening new avenues for creativity and user interaction. Start experimenting with the action parameters today to see what stunning images you can generate!