Enhance Your Applications with Custom Image Generation Using MiaoMiao-Harem-Illustrious-v1 Actions

The MiaoMiao-Harem-Illustrious-v1 API offers developers a robust set of capabilities for generating customized images using advanced AI models. This API provides pre-built Cognitive Actions that allow you to create detailed and high-quality images based on specific prompts and configurations. By leveraging these actions, developers can automate image creation, streamline workflows, and enhance user experiences in their applications.
Prerequisites
Before you begin integrating the Cognitive Actions, ensure you have the following:
- An API key for accessing the Cognitive Actions platform.
- A basic understanding of JSON and how to make API calls.
- Familiarity with Python for executing API requests.
To authenticate your requests, you will need to pass your API key in the request headers. This will typically look like:
Authorization: Bearer YOUR_COGNITIVE_ACTIONS_API_KEY
Cognitive Actions Overview
Generate Custom Image
The Generate Custom Image action allows you to create images using specific prompts and model parameters. This action is particularly useful for applications that require artistic or character-specific visual content.
- Category: Image Generation
- Purpose: Generates custom images using the MiaoMiao-Harem-Illustrious-v1 model with detailed configurations.
Input
The action requires a JSON object conforming to the following schema:
{
"seed": -1,
"model": "MiaoMiao-Harem-Illustrious-v1",
"steps": 30,
"width": 1024,
"height": 1024,
"prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile",
"refiner": false,
"upscale": "Original",
"pagScale": 0,
"scheduler": "DPM2 a Karras",
"clipLayerSkip": 2,
"autoDetailerFace": false,
"autoDetailerHand": false,
"refinerPromptText": "",
"autoDetailerPerson": false,
"configurationScale": 6,
"negativePromptText": "nsfw, naked",
"prependIntroduction": true,
"refinerStrengthLevel": 0.4,
"guidanceRescaleAmount": 1,
"autoDetailerFacePrompt": "",
"autoDetailerHandPrompt": "",
"promptConjunctionSyntax": true,
"autoDetailerPersonPrompt": "",
"visualAttentionExtraction": "default",
"autoDetailerFaceNegativePrompt": "",
"autoDetailerHandNegativePrompt": "",
"negativePromptConjunctionSyntax": false,
"autoDetailerPersonNegativePrompt": ""
}
Example Input
{
"seed": -1,
"model": "MiaoMiao-Harem-Illustrious-v1",
"steps": 30,
"width": 1024,
"height": 1024,
"prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile",
"refiner": false,
"upscale": "Original",
"pagScale": 0,
"scheduler": "DPM2 a Karras",
"clipLayerSkip": 2,
"autoDetailerFace": false,
"autoDetailerHand": false,
"refinerPromptText": "",
"autoDetailerPerson": false,
"configurationScale": 6,
"negativePromptText": "nsfw, naked",
"prependIntroduction": true,
"refinerStrengthLevel": 0.4,
"guidanceRescaleAmount": 1,
"autoDetailerFacePrompt": "",
"autoDetailerHandPrompt": "",
"promptConjunctionSyntax": true,
"autoDetailerPersonPrompt": "",
"visualAttentionExtraction": "default",
"autoDetailerFaceNegativePrompt": "",
"autoDetailerHandNegativePrompt": "",
"negativePromptConjunctionSyntax": false,
"autoDetailerPersonNegativePrompt": ""
}
Output
The action typically returns a URL to the generated image:
[
"https://assets.cognitiveactions.com/invocations/b1b25266-d644-438e-88c8-663fee7b69f8/c8fa6b82-1d20-447b-a45c-67a906753fc6.png"
]
Conceptual Usage Example (Python)
Here’s a conceptual example of how to call the Generate Custom 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 = "37ec3aa2-9606-4395-a638-2965eeb2b091" # Action ID for Generate Custom Image
# Construct the input payload based on the action's requirements
payload = {
"seed": -1,
"model": "MiaoMiao-Harem-Illustrious-v1",
"steps": 30,
"width": 1024,
"height": 1024,
"prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile",
"refiner": False,
"upscale": "Original",
"pagScale": 0,
"scheduler": "DPM2 a Karras",
"clipLayerSkip": 2,
"autoDetailerFace": False,
"autoDetailerHand": False,
"refinerPromptText": "",
"autoDetailerPerson": False,
"configurationScale": 6,
"negativePromptText": "nsfw, naked",
"prependIntroduction": True,
"refinerStrengthLevel": 0.4,
"guidanceRescaleAmount": 1,
"autoDetailerFacePrompt": "",
"autoDetailerHandPrompt": "",
"promptConjunctionSyntax": True,
"autoDetailerPersonPrompt": "",
"visualAttentionExtraction": "default",
"autoDetailerFaceNegativePrompt": "",
"autoDetailerHandNegativePrompt": "",
"negativePromptConjunctionSyntax": False,
"autoDetailerPersonNegativePrompt": ""
}
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}")
Conclusion
The MiaoMiao-Harem-Illustrious-v1 API's Generate Custom Image action empowers developers to create stunning, customized visuals effortlessly. By utilizing the detailed parameters available, you can fine-tune the image generation process to suit your application's needs. Explore more use cases and consider incorporating these actions into your projects for enhanced creativity and engagement!