Create Stunning Images with Terek View's Custom Settings

25 Apr 2025
Create Stunning Images with Terek View's Custom Settings

Terek View offers a powerful API for developers looking to generate images with remarkable precision and creativity. With its advanced image generation capabilities, Terek View enables users to create visually stunning images tailored to specific requirements. By leveraging features such as image-to-image translation, inpainting, and prompt-driven transformations, developers can enhance their projects with unique and engaging visuals.

Imagine needing to create personalized graphics for a marketing campaign, visual content for a blog, or even artwork for a game. With Terek View, you can quickly generate high-quality images that match your vision, saving both time and resources. Its ability to fine-tune aspects like guidance scale, LoRA intensity, and image quality means that you can achieve the perfect balance of speed and detail in your generated images.

Prerequisites

Before you get started, ensure you have a valid Cognitive Actions API key and a basic understanding of making API calls.

Generate Image with Custom Settings

The Generate Image with Custom Settings action allows users to create images using various advanced parameters. This action addresses the need for customization in image generation, enabling developers to produce images that meet their specific artistic and functional requirements.

Input Requirements

The input for this action is structured as a CompositeRequest object, which includes several properties such as:

  • prompt: A detailed description of the desired image. This is the most critical input that guides the generation process.
  • image: An optional input image used for image-to-image transformations.
  • mask: Used for inpainting, this defines areas of the image to be altered.
  • aspectRatio, width, and height: These define the dimensions of the output image.
  • goFast: This boolean flag allows for faster image generation at the cost of some quality.
  • Additional parameters like guidanceScale, promptStrength, and numInferenceSteps help refine the output.

Expected Output

The action returns an array of URLs pointing to the generated images in the specified format (e.g., PNG, JPG, WEBP). Each URL corresponds to an image created based on the provided prompt and settings.

Use Cases for this Specific Action

  • Marketing and Advertising: Quickly generate promotional images tailored to specific campaigns or products.
  • Content Creation: Create unique visuals for blog posts, social media, or other digital content to enhance engagement.
  • Artistic Projects: Utilize the inpainting feature to modify existing images or transform concepts into visually appealing art.
  • Game Development: Generate assets such as backgrounds or character designs based on detailed prompts, streamlining the creative process.

```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 = "54dc1957-d254-46be-a496-c9887a0a65f7" # Action ID for: Generate Image with Custom Settings

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "model": "dev",
  "goFast": false,
  "prompt": "A hot air balloon, painted in the colors of the Ossetian flag—white on top, red in the middle, and yellow on the bottom—floats gracefully in the sky during sunrise over Vladikavkaz. The word \"AMRITA\" is boldly displayed on the balloon’s envelope, standing out against the vibrant tricolor design.\n\nBelow, the historic buildings of Vladikavkaz stretch along the riverbank, their facades bathed in the warm golden light of dawn. The calm river reflects the soft pastel hues of the sky, and a gentle morning mist rises above the water, adding a dreamy, atmospheric touch.\n\nIn the background, the majestic Terek Mountain Range (TRKV) dominates the horizon, its snow-covered peaks glowing with the first light of the morning. Wisps of clouds and fog drift around the rugged slopes, creating a sense of depth and grandeur.\n\n Lighting: Warm, golden sunrise casting soft highlights and long shadows.\n Details: The balloon’s vivid tricolor design contrasts beautifully with the natural tones of the landscape.\nCamera angle: Wide-angle shot, slightly upward perspective, capturing the balloon in the sky with the breathtaking scenery below.\n\nMood & Atmosphere: A peaceful and awe-inspiring moment, blending tradition, adventure, and the beauty of nature.",
  "loraScale": 0.94,
  "megapixels": "1",
  "numOutputs": 4,
  "aspectRatio": "9:16",
  "outputFormat": "png",
  "guidanceScale": 2.58,
  "outputQuality": 80,
  "extraLoraScale": 0.7,
  "promptStrength": 0.8,
  "numInferenceSteps": 28
}

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
Terek View's image generation capabilities provide developers with a versatile tool for creating high-quality, customized images. The ability to manipulate various parameters allows for a wide range of applications, from marketing to artistic endeavors. By integrating Terek View into your workflow, you can enhance your projects with stunning visuals that capture your audience's attention. Start exploring the potential of Terek View today and take your image generation to new heights!