Refine Your Creative Process: A Guide to Image Generation with Felixyifeiwang's EOM Character Actions

In the realm of image generation, the felixyifeiwang/eom-character API offers powerful Cognitive Actions that enable developers to create and refine images based on specific prompts and input masks. The primary action, Generate Refined Images with Inpainting, allows for intricate control over the image generation process, making it ideal for applications in gaming, art, and more. By leveraging these pre-built actions, developers can streamline their workflows and enhance their applications with sophisticated image manipulation capabilities.
Prerequisites
Before diving into the implementation of the Cognitive Actions, ensure you have the following:
- An API key for the Cognitive Actions platform to authenticate your requests.
- A basic understanding of JSON and RESTful APIs.
- Familiarity with making HTTP requests in your programming language of choice, such as Python.
For authentication, you will typically pass your API key in the request headers as follows:
Authorization: Bearer YOUR_API_KEY
Cognitive Actions Overview
Generate Refined Images with Inpainting
This action allows you to generate and refine images based on input masks and prompts. It preserves specific details while modifying others, giving developers the flexibility to produce multiple image outputs with configurable parameters.
Input
The input schema for this action is as follows:
- seed: (integer, optional) Random seed value for deterministic outputs. Default is random.
- image: (string, required) URI of the input image for inpainting.
- width: (integer, optional) Width of the output image in pixels. Default is 1024.
- height: (integer, optional) Height of the output image in pixels. Default is 1024.
- prompt: (string, required) Descriptive prompt for image generation.
- inputMask: (string, optional) URI of the input mask for inpaint mode.
- refineStyle: (string, optional) Select refine style: 'no_refiner', 'expert_ensemble_refiner', or 'base_image_refiner'. Default is 'no_refiner'.
- inversePrompt: (string, optional) Negative prompt to influence image generation.
- refinementSteps: (integer, optional) Steps for refinement. Defaults to inference steps.
- outputImageCount: (integer, optional) Number of images to generate (1-4). Default is 1.
- highNoiseFraction: (number, optional) Fraction of high noise for expert ensemble refiner. Default is 0.8.
- inferenceStepCount: (integer, optional) Steps used for image denoising (1-500). Default is 50.
- schedulingStrategy: (string, optional) Choose a scheduling strategy (e.g., 'K_EULER'). Default is 'K_EULER'.
- applyImageWatermark: (boolean, optional) Apply a watermark to generated images. Default is true.
- loraAdjustmentScale: (number, optional) Additive scale for LoRA adjustments. Default is 0.6.
- omitSafetyValidation: (boolean, optional) Disable safety validation. Default is false.
- initialPromptIntensity: (number, optional) Intensity of the prompt (0-1). Default is 0.8.
- guidanceAdjustmentScale: (number, optional) Scale factor for classifier-free guidance. Default is 7.5.
Example Input:
{
"width": 1024,
"height": 1024,
"prompt": "A TOK game character: a beautiful dragon lady, full body",
"refineStyle": "no_refiner",
"inversePrompt": "",
"outputImageCount": 1,
"highNoiseFraction": 0.8,
"inferenceStepCount": 50,
"schedulingStrategy": "K_EULER",
"applyImageWatermark": true,
"loraAdjustmentScale": 0.6,
"initialPromptIntensity": 0.8,
"guidanceAdjustmentScale": 7.5
}
Output
The action typically returns an array of image URLs, showcasing the generated images based on the input criteria.
Example Output:
[
"https://assets.cognitiveactions.com/invocations/2380e294-f911-498b-b01e-c44d1be97def/8848471a-0b5f-46ac-be12-cd8a89d799c1.png"
]
Conceptual Usage Example (Python)
Here’s a conceptual example of how you might call the Cognitive Actions execution endpoint 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 = "a2268f11-c9ac-451a-9209-8dd5242eacb1" # Action ID for Generate Refined Images with Inpainting
# Construct the input payload based on the action's requirements
payload = {
"width": 1024,
"height": 1024,
"prompt": "A TOK game character: a beautiful dragon lady, full body",
"refineStyle": "no_refiner",
"inversePrompt": "",
"outputImageCount": 1,
"highNoiseFraction": 0.8,
"inferenceStepCount": 50,
"schedulingStrategy": "K_EULER",
"applyImageWatermark": True,
"loraAdjustmentScale": 0.6,
"initialPromptIntensity": 0.8,
"guidanceAdjustmentScale": 7.5
}
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, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable is constructed based on the required inputs for the action. The endpoint URL and request structure are illustrative, focusing on how to format the request to the Cognitive Actions API.
Conclusion
The Generate Refined Images with Inpainting action from the felixyifeiwang/eom-character API provides developers with an advanced toolkit for image generation and refinement. By utilizing this action, you can create visually stunning images tailored to your specifications, enhancing your applications’ capabilities in artistic and creative domains. Consider exploring other potential use cases and integrating these actions to elevate your projects further!