Transform Your Images with Neon Tokyo's Rainy Night Style Using Cognitive Actions

Integrating vibrant, atmospheric visuals into your applications has never been easier with the levelsio/neon-tokyo Cognitive Actions. This powerful image generation tool allows developers to create stunning imagery in the distinctive aesthetic of rainy Tokyo nights, complete with neon lights. Leveraging pre-built actions offers significant benefits, including optimized performance, variety in image outputs, and simplified integration into your applications.
Prerequisites
Before you begin using the Cognitive Actions for image generation, ensure that you have the following:
- An API key for the Cognitive Actions platform to authenticate your requests.
- Basic familiarity with making HTTP requests and handling JSON data.
To authenticate your requests, you will typically include your API key in the headers of your API calls.
Cognitive Actions Overview
Generate Neon Tokyo Rainy Night Style Photos
This action allows you to create images that encapsulate the essence of rainy nights in Tokyo, characterized by vibrant neon lights and atmospheric settings. You can select different models to optimize performance based on your needs.
- Category: Image Generation
Input
The input for this action consists of a JSON object. Below are the required and optional fields, along with an example input payload:
- Required Fields:
prompt: A string describing the scene you want to generate. (e.g., "a street at night rainy in style of TKYO")
- Optional Fields:
model: Model selection for inference (default: "dev").loraScale: Intensity of the main LoRA weights (default: 1).guidanceScale: Scale for guiding the diffusion process (default: 3).outputQuality: Quality level for saving output images (default: 80).numberOfOutputs: Number of image outputs to generate (default: 1).imageAspectRatio: Desired aspect ratio (default: "1:1").imageOutputFormat: Format for image output files (default: "webp").numberOfInferenceSteps: Total denoising steps to perform (default: 28).
Example Input:
{
"model": "dev",
"prompt": "a street at night rainy in style of TKYO",
"loraScale": 0.75,
"guidanceScale": 3.5,
"outputQuality": 80,
"numberOfOutputs": 4,
"imageAspectRatio": "4:3",
"imageOutputFormat": "jpg",
"numberOfInferenceSteps": 28
}
Output
Upon successful execution, this action returns a list of URLs to the generated images. Below is an example of the output you might receive:
Example Output:
[
"https://assets.cognitiveactions.com/invocations/ff239759-3831-4fb0-b67a-127db8a0e0d7/3060b49e-7172-4830-be8f-c2ec491ea70c.jpg",
"https://assets.cognitiveactions.com/invocations/ff239759-3831-4fb0-b67a-127db8a0e0d7/89474312-1029-47fa-b3ef-1cd8f5613f23.jpg",
"https://assets.cognitiveactions.com/invocations/ff239759-3831-4fb0-b67a-127db8a0e0d7/1be6c99d-817c-4f45-915f-447e94285ef8.jpg",
"https://assets.cognitiveactions.com/invocations/ff239759-3831-4fb0-b67a-127db8a0e0d7/58f09fe2-ba1f-42d4-9be8-0b49c855cb67.jpg"
]
Conceptual Usage Example (Python)
Here’s a conceptual Python snippet illustrating how you might call the Cognitive Actions endpoint for this image generation action:
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 = "d14f6695-38c5-4860-91c7-c1411364cd5e" # Action ID for Generate Neon Tokyo Rainy Night Style Photos
# Construct the input payload based on the action's requirements
payload = {
"model": "dev",
"prompt": "a street at night rainy in style of TKYO",
"loraScale": 0.75,
"guidanceScale": 3.5,
"outputQuality": 80,
"numberOfOutputs": 4,
"imageAspectRatio": "4:3",
"imageOutputFormat": "jpg",
"numberOfInferenceSteps": 28
}
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 code snippet, replace the YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action_id reflects the specific action you are invoking. The payload is built according to the input schema and sent to the hypothetical endpoint for processing.
Conclusion
The levelsio/neon-tokyo Cognitive Actions provide developers with a powerful tool to generate visually stunning images that capture the essence of rainy Tokyo nights. By utilizing these pre-built actions, you can enhance your applications with vibrant, atmospheric visuals effortlessly. Explore potential use cases such as enhancing digital art, creating engaging backgrounds for apps, or generating unique content for social media.
Start integrating these capabilities today and bring the mesmerizing ambiance of Neon Tokyo to your projects!