Generate Stunning Images of Audrey Hepburn with yasuda0404/photoaudrey Cognitive Actions

The yasuda0404/photoaudrey API provides developers with powerful Cognitive Actions tailored for image generation. By leveraging a fine-tuned Stable Diffusion model via DreamBooth, you can create lifelike images of the iconic Audrey Hepburn. These pre-built actions simplify the process of generating high-quality images based on specific prompts, enabling developers to integrate advanced visual capabilities into their applications effortlessly.
Prerequisites
Before you begin integrating the Cognitive Actions, ensure you have the following:
- API Key: You will need an API key to authenticate your requests to the Cognitive Actions platform.
- Setup: Familiarize yourself with the API documentation for the specific endpoint to understand the structure and requirements for making requests.
For authentication, you typically include your API key in the request headers, allowing you to securely authenticate your calls to the Cognitive Actions service.
Cognitive Actions Overview
Generate Audrey Hepburn Image
Description: This action generates images of Audrey Hepburn based on user-defined prompts, starting with "photo of audrey" to accurately capture her likeness and essence.
- Category: image-generation
Input
The action requires the following fields:
- prompt (string): A required field where you specify the prompt. Start your prompt with "photo of audrey".
- width (integer): The width of the output image. Choose from predefined values: 128, 256, 512, 768, or 1024 (default: 512).
- height (integer): The height of the output image, also limited to predefined values (default: 512).
- guidanceScale (number): Controls the quality of the image generation, with a range from 1 to 20 (default: 7.5).
- numberOfOutputs (integer): The number of images to generate, either 1 or 4 (default: 1).
- numberOfInferenceSteps (integer): Specifies the number of denoising steps during image generation, ranging from 1 to 500 (default: 50).
- seed (integer, optional): A random seed for initializing the random number generator (leave blank for a random seed).
- negativePrompt (string, optional): A prompt to exclude certain features from the image.
Example Input:
{
"width": 512,
"height": 512,
"prompt": "photo of audrey writing a letter to her mother",
"guidanceScale": 7.5,
"numberOfOutputs": 1,
"numberOfInferenceSteps": 50
}
Output
The action typically returns an array of URLs pointing to the generated images. For instance:
Example Output:
[
"https://assets.cognitiveactions.com/invocations/224247cb-3447-496e-b88a-efbf30d6efde/c74eb95b-6b8f-4c0e-85d8-c90cec129532.png"
]
Conceptual Usage Example (Python)
Here’s how you can call the Generate Audrey Hepburn Image 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 = "8db92971-7d71-4ba4-9ccb-b2ddc0a8190d" # Action ID for Generate Audrey Hepburn Image
# Construct the input payload based on the action's requirements
payload = {
"width": 512,
"height": 512,
"prompt": "photo of audrey writing a letter to her mother",
"guidanceScale": 7.5,
"numberOfOutputs": 1,
"numberOfInferenceSteps": 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 Python code snippet, you specify the action ID and input payload directly based on the requirements provided. The endpoint URL and request structure are illustrative; ensure you adapt them according to your setup.
Conclusion
The yasuda0404/photoaudrey Cognitive Actions empower developers to create beautiful images of Audrey Hepburn with ease. By utilizing these actions, you can enhance your applications with rich visual content tailored to user prompts. Consider exploring additional creative possibilities and integrating this functionality into your projects for unique user experiences. Happy coding!