Create Stunning Images from Text Prompts with Aura Flow

25 Apr 2025
Create Stunning Images from Text Prompts with Aura Flow

In today's digital landscape, the ability to convert textual descriptions into visually appealing images opens up a world of possibilities for developers and creators alike. Aura Flow provides a robust platform for text-to-image generation, leveraging one of the largest open-sourced flow-based generation models available. With Aura Flow, you can generate high-quality images customized to your specifications, enhancing creativity and productivity.

Imagine being able to create unique visuals for your projects without the need for extensive graphic design skills. Whether you're developing marketing materials, designing characters for a game, or creating custom illustrations for stories, Aura Flow simplifies the image generation process, allowing you to focus on your creative vision. This service is particularly useful for artists, marketers, and developers looking to automate or enhance their visual content generation.

Prerequisites

To get started with Aura Flow, you will need an API key for Cognitive Actions and a basic understanding of making API calls.

Generate Text-to-Image with AuraFlow

Aura Flow's text-to-image generation action allows you to create images based on detailed textual prompts. This action addresses the need for high-quality, customized visuals that are tailored to specific ideas or themes.

Input Requirements

The input for this action is a structured request that includes several parameters:

  • Prompt: A detailed description of the image you want to generate.
  • Width & Height: Specifies the dimensions of the image in pixels (from 512 to 2048).
  • Steps: The number of iterations for image refinement (1 to 100).
  • Output Format: The desired file format for the image (webp, jpg, png).
  • Guidance Scale: Determines how closely the generated image follows the prompt.
  • Output Quality: Quality level of the output image (0 to 100).
  • Negative Prompt: Elements to avoid in the generated image.
  • Number of Images: Total images to generate (1 to 10).
  • Sampling Method & Scheduling Method: Techniques used during image generation.

Expected Output

The expected output is a link to the generated image file based on your specifications. For example:

  • ["https://assets.cognitiveactions.com/invocations/d2656090-c5bc-48ca-9bac-afeb871350fa/f4337ecb-a8d8-483f-9eab-8b30935a699b.webp"]

Use Cases for this Specific Action

  • Marketing Campaigns: Generate unique visuals for advertisements or social media posts to capture audience attention.
  • Character Design: Create custom characters for games or animations based on specific traits described in the prompt.
  • Story Illustration: Bring stories to life by generating illustrations that match the narrative, enhancing user engagement.
  • Creative Projects: Empower artists and creators to visualize their ideas quickly, allowing for rapid prototyping and iteration.
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 = "2b7c2272-7525-4509-945a-1e794f16d5ef" # Action ID for: Generate Text-to-Image with AuraFlow

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "steps": 25,
  "width": 1024,
  "height": 1024,
  "prompt": "a stylized cartoon image, yellow background, a smiling turtle holding a pizza, the turtle is wearing a white and brown cap, large eyes and a friendly expression, the turtle is standing on its hind legs, the pizza is held in both of its front legs, small clouds and trees on either side of the turtle, the text \"Turtle Pizza\" is in large brown letters at the top, the text \"No More Hungry\" at the bottom in brown, the overall style is retro with halftone shading",
  "outputFormat": "webp",
  "guidanceScale": 3.5,
  "outputQuality": 80,
  "timestepShift": 1.73,
  "negativePrompt": "ugly, broken",
  "numberOfImages": 1,
  "samplingMethod": "uni_pc",
  "schedulingMethod": "normal"
}

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

Aura Flow's text-to-image generation action is a powerful tool that caters to a variety of creative needs. By transforming text prompts into high-quality images, it simplifies the process of visual content creation, allowing developers and creators to enhance their projects efficiently. Whether you're looking to automate image generation for your applications or simply want to explore new creative avenues, Aura Flow is your gateway to innovative visual storytelling. Start integrating Aura Flow into your projects today and unlock the potential of AI-driven image generation!