Create Stunning Custom Images with China Zorrilla

26 Apr 2025
Create Stunning Custom Images with China Zorrilla

In today's digital landscape, the ability to generate high-quality, customized images on demand is a game changer for developers and businesses alike. The "China Zorrilla" service provides powerful Cognitive Actions that allow you to create unique imagery tailored to your specific needs. With advanced features like image inpainting, customizable dimensions, and enhanced prompt-based customization, this service simplifies the image generation process while delivering impressive results.

Whether you're developing applications for marketing, e-commerce, or social media, the ability to produce visually striking images quickly can significantly enhance user engagement and brand presence. Imagine being able to create a cinematic image of a character or product with just a few lines of code—this is the power of the "Generate Custom Style Image" action.

Prerequisites

To get started with the China Zorrilla Cognitive Actions, you will need a valid API key and a basic understanding of how to make API calls.

Generate Custom Style Image

This action generates a custom image based on a specified prompt, offering options for inpainting, dimensions, and style customization. It allows for fine-tuning through LoRA weights and provides the ability to optimize generation speed with fp8 quantization. This flexibility means you can create images that meet unique requirements for aspect ratio, quality, and artistic style.

Input Requirements

The input for this action is structured as a JSON object that includes the following key properties:

  • prompt: A textual description that guides the image generation (required).
  • image: An optional input image for image-to-image transformations or inpainting.
  • mask: An optional image mask for inpainting mode.
  • model: Specifies the model for inference (options include "dev" and "schnell").
  • width and height: Specify dimensions for the generated image, applicable only in custom aspect ratio mode.
  • aspectRatio: Determines the aspect ratio of the generated image.
  • numOutputs: The number of images to generate (1 to 4).
  • outputFormat: Format of the output image (e.g., "webp", "jpg", "png").
  • guidanceScale, mainLoraScale, extraLoraScale, outputQuality, promptStrength, and numInferenceSteps: These parameters allow for fine-tuning the image generation process.

Expected Output

The output will be an array containing the URLs of the generated images in the specified format. For example, a successful request might return a URL like this:

[
  "https://assets.cognitiveactions.com/invocations/3ae61097-7463-4d02-b6f8-b5e9691e09ef/2d1a13f7-2567-4876-a691-66ffa4dd6f32.webp"
]

Use Cases for this Action

  • Marketing and Advertising: Create tailored images for campaigns that resonate with your target audience.
  • E-commerce: Generate product images that highlight features or variations without needing a photo shoot.
  • Content Creation: Produce unique visuals for blogs, social media, or other digital content to enhance storytelling.
  • Artistic Projects: Experiment with different styles and prompts to create original artwork or concepts for games and applications.

```python
import requests
import json

# Replace with your actual Cognitive Actions API key and endpoint
# Ensure your environment securely handles the API key
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
# This endpoint URL is hypothetical and should be documented for users
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"

action_id = "6dc94562-5370-4646-a220-204f9a69ed11" # Action ID for: Generate Custom Style Image

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "model": "schnell",
  "prompt": "A cinematic photo hollywood style of 70 year old CHNZRRLL woman. ",
  "extraLora": "https://huggingface.co/XLabs-AI/flux-RealismLora",
  "numOutputs": 1,
  "aspectRatio": "1:1",
  "outputFormat": "webp",
  "guidanceScale": 3.5,
  "mainLoraScale": 1,
  "outputQuality": 90,
  "extraLoraScale": 1,
  "promptStrength": 0.8,
  "numInferenceSteps": 4
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json",
    # Add any other required headers for the Cognitive Actions API
}

# Prepare the request body for the hypothetical execution endpoint
request_body = {
    "action_id": action_id,
    "inputs": payload
}

print(f"--- Calling Cognitive Action: {action.name or action_id} ---")
print(f"Endpoint: {COGNITIVE_ACTIONS_EXECUTE_URL}")
print(f"Action ID: {action_id}")
print("Payload being sent:")
print(json.dumps(request_body, indent=2))
print("------------------------------------------------")

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json=request_body
    )
    response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)

    result = response.json()
    print("Action executed successfully. Result:")
    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 (non-JSON): {e.response.text}")
    print("------------------------------------------------")


## Conclusion
The China Zorrilla service unlocks new possibilities for developers looking to integrate customizable image generation into their projects. With the "Generate Custom Style Image" action, you can produce high-quality images that align with your creative vision and business goals, all while saving time and resources. 

To get started, experiment with different prompts and parameters to see the range of images you can generate, and consider how this technology can enhance your applications and user experiences.