Create Stunning Immersive Visualizations with Inmersive Test

26 Apr 2025
Create Stunning Immersive Visualizations with Inmersive Test

In today's digital landscape, developers are increasingly tasked with creating engaging and immersive experiences that captivate users. The Inmersive Test service offers a powerful Cognitive Action designed specifically for this purpose: the ability to train immersive visualization models. This action leverages advanced techniques like image inpainting and image-to-image transformations, allowing developers to generate high-quality visual content that resonates with viewers. By optimizing speed and enhancing image quality, Inmersive Test simplifies the process of producing stunning visuals, making it an invaluable tool for developers in various fields.

Imagine creating immersive environments for art installations, virtual exhibitions, or educational experiences with a few lines of code. The possibilities are vast, from museums showcasing interactive exhibits to marketing campaigns that require eye-catching visuals. Whether you’re designing a new game, developing an app, or enhancing a website, the Inmersive Test can help you bring your creative vision to life.

Prerequisites

To get started with Inmersive Test, you will need a Cognitive Actions API key and a basic understanding of how to make API calls.

Train Immersive Visualization Model

The "Train Immersive Visualization Model" action is intended to generate immersive visualizations tailored to your specifications. By utilizing techniques such as image inpainting and configurable aspect ratios, this action allows for detailed and customized image outputs. It effectively addresses the challenge of creating unique visual content that meets specific design requirements.

Input Requirements

To use this action, you must provide a "prompt" that describes the desired image. Additional optional inputs include:

  • mask: A URI for an image mask used in inpainting mode.
  • image: A URI for the input image, applicable in image-to-image or inpainting modes.
  • width and height: Dimensions for the generated image (only relevant if using a custom aspect ratio).
  • modelType: Choose between "dev" for performance or "schnell" for speed.
  • outputCount: The number of images you wish to generate (between 1 and 4).
  • imageAspectRatio: The aspect ratio for the generated image.

Expected Output

The action will return a generated image based on the provided prompt and specifications. The output will be a URI pointing to the generated image file, which can be in formats such as webp, jpg, or png.

Use Cases for this specific action

  • Art Installations: Create immersive visualizations for exhibitions, enhancing visitor engagement through interactive displays.
  • Marketing Campaigns: Develop eye-catching visuals that stand out in digital advertising, driving higher engagement rates.
  • Educational Tools: Generate visuals for educational content, making learning more interactive and visually appealing.
  • Gaming Environments: Design unique game assets that enhance the player's experience through immersive graphics.
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 = "6814c8ee-9be8-4ba4-aabc-fb8608feff5a" # Action ID for: Train Immersive Visualization Model

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "prompt": "Crea una imagen imviz de un gran cubo en el centro de un amplio lobby de un evento sobre la mariposa monarca. En una de sus caras, muestra mariposas monarca volando en un ambiente boscoso, con árboles y un fondo natural que resalte su belleza. En otra cara del cubo, presenta una cédula museográfica con un diseño limpio en letra Helvética, donde el título “Mariposa Monarca” está en un tamaño destacado. Debajo, detalla el texto que explica la instalación, con un fondo blanco y texto negro para garantizar legibilidad.\n\nAlrededor del cubo, incluye varias personas de diferentes edades observando la instalación con interés, algunas tomando fotos y otras leyendo la cédula. Aprovecha el espacio del cuarto grande para agregar otros cubos similares, creando un laberinto donde los visitantes pueden trasladarse, disfrutando de una experiencia inmersiva sobre la mariposa monarca.\n\nAsegúrate de incluir una iluminación suave que complemente la atmósfera del evento y resalte los colores vibrantes de las mariposas y el entorno.",
  "modelType": "dev",
  "outputCount": 1,
  "loraWeightScale": 1,
  "promptIntensity": 0.8,
  "imageAspectRatio": "1:1",
  "imageOutputFormat": "webp",
  "imageGuidanceScale": 3.5,
  "imageOutputQuality": 90,
  "inferenceStepCount": 28,
  "extraLoraWeightScale": 1
}

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

Inmersive Test provides developers with the tools necessary to create stunning, immersive visualizations that enhance user experiences. By utilizing the "Train Immersive Visualization Model" action, you can streamline the production of high-quality images tailored to your unique specifications. As you explore this service, consider the various applications in your projects, and start integrating immersive visualizations that captivate and engage your audience. The next step is to experiment with different prompts and configurations to unlock the full potential of this powerful tool.