Generate Stunning 360-Degree Images with igorriti/flux-360 Cognitive Actions

Integrating immersive experiences into applications has never been easier with the igorriti/flux-360 API. This powerful service offers a unique Cognitive Action designed to generate 360-degree panorama images, perfect for storytelling in virtual reality (VR) environments. By utilizing pre-built actions, developers can seamlessly create high-quality visual content with customizable settings, enhancing user engagement and interaction.
Prerequisites
Before diving into the integration of the igorriti/flux-360 Cognitive Actions, ensure you have the following:
- API Key: You will need an API key to authenticate your requests. This key should be included in the headers of your HTTP requests to access the Cognitive Actions platform.
- Environment Setup: Make sure to have an environment capable of making HTTP requests, such as Python with the
requestslibrary.
Authentication typically involves passing your API key as a bearer token in the request headers.
Cognitive Actions Overview
Generate 360 Panorama Images
The Generate 360 Panorama Images action allows you to create stunning immersive 360-degree images that can be used in various storytelling spaces, particularly in VR. This action leverages the LoRA model, enabling options for sound integration, image resolution, and output format.
Input
The following fields are required and optional for the action:
- Required Fields:
prompt(string): A descriptive prompt for the image you want to create.
- Optional Fields:
mask(string): URI for an image mask used in inpainting mode.seed(integer): Random seed for consistent image generation.image(string): URI for an input image used in image-to-image or inpainting mode.width(integer): Width of the generated image in pixels (256-1440).height(integer): Height of the generated image in pixels (256-1440).imageFormat(string): Format for output images (default iswebp).imageQuality(integer): Quality level of the output image (0-100).modelWeights(string): Load LORA model weights.enableFastMode(boolean): Enable fast generation mode.inferenceModel(string): Select the model used for inference (devorschnell).imageMegapixels(string): Approximate number of megapixels for the generated image.loraWeightScale(number): Intensity of the main LoRA application.numberOfOutputs(integer): Number of images to generate (1-4).promptIntensity(number): Strength of the prompt in img2img mode.imageAspectRatio(string): Select the aspect ratio of the generated image.guidanceIntensity(number): Guidance intensity during the diffusion process.inferenceStepsCount(integer): Number of denoising steps.additionalLoraWeights(string): Load additional LoRA weights.safetyCheckerDisabled(boolean): Disable the safety checker for generated images.additionalLoraIntensity(number): Adjust strength of additional LoRA.
Example Input:
{
"prompt": "A 3d render of a futuristic landscape. There's a city with stone buildings in the background and a forest. 360 view in the style of TOK",
"imageFormat": "webp",
"imageQuality": 80,
"inferenceModel": "dev",
"loraWeightScale": 1,
"numberOfOutputs": 4,
"imageAspectRatio": "3:2",
"guidanceIntensity": 3.5,
"inferenceStepsCount": 50,
"additionalLoraIntensity": 0.8
}
Output
The action typically returns an array of URLs pointing to the generated images. Here is an example output:
Example Output:
[
"https://assets.cognitiveactions.com/invocations/cc0e3179-4c02-4e48-a75a-ca307f2e4c51/df81388d-0e6c-40c3-a392-ac16d17b0ce0.webp",
"https://assets.cognitiveactions.com/invocations/cc0e3179-4c02-4e48-a75a-ca307f2e4c51/41e2db6c-1c3a-4700-bea8-7c88b419c542.webp",
"https://assets.cognitiveactions.com/invocations/cc0e3179-4c02-4e48-a75a-ca307f2e4c51/f830e66e-63c3-4c46-866b-01cb1d019aed.webp",
"https://assets.cognitiveactions.com/invocations/cc0e3179-4c02-4e48-a75a-ca307f2e4c51/2c7877b8-a43f-442b-a515-7fd130924617.webp"
]
Conceptual Usage Example (Python)
Here’s how you might call the Generate 360 Panorama Images 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 = "37692efc-a444-4ac2-bbee-4b2931866a8a" # Action ID for Generate 360 Panorama Images
# Construct the input payload based on the action's requirements
payload = {
"prompt": "A 3d render of a futuristic landscape. There's a city with stone buildings in the background and a forest. 360 view in the style of TOK",
"imageFormat": "webp",
"imageQuality": 80,
"inferenceModel": "dev",
"loraWeightScale": 1,
"numberOfOutputs": 4,
"imageAspectRatio": "3:2",
"guidanceIntensity": 3.5,
"inferenceStepsCount": 50,
"additionalLoraIntensity": 0.8
}
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 example, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key, and ensure that the endpoint is correct. This code snippet demonstrates how to structure the input JSON payload properly.
Conclusion
The igorriti/flux-360 Cognitive Actions empower developers to create captivating 360-degree images effortlessly. By leveraging these pre-built actions, you can enhance your applications with stunning visuals that engage users in new and exciting ways. Explore further possibilities with the generated images and consider integrating audio elements to enrich the storytelling experience. Happy coding!