Create Stunning Custom Images with Nep2no's Image Generation

26 Apr 2025
Create Stunning Custom Images with Nep2no's Image Generation

In the world of digital content creation, the ability to generate unique and captivating images is invaluable. The Nep2no service offers powerful Cognitive Actions that enable developers to leverage advanced image generation techniques. With the "Generate Image with Mask and Lora Weights" action, you can produce stunning visuals tailored to specific requirements, enhancing your projects with high-quality graphics. This action simplifies the workflow for image creation, allowing for fine-tuning in terms of detail, speed, and customization.

Common use cases for this action include creating illustrations for websites, generating assets for marketing campaigns, or producing personalized artwork for various applications. By utilizing LoRA weights and image masks, developers can ensure that the generated images meet their exact specifications, whether for artistic endeavors or commercial projects.

Prerequisites

To get started with Nep2no's Cognitive Actions, you'll need an API key and a basic understanding of how to make API calls.

Generate Image with Mask and Lora Weights

This action allows you to create custom images by leveraging various LoRA weights and image masks. The flexibility to set specific image dimensions, choose output formats, and adjust inference steps provides you with extensive control over the resulting visuals.

Input Requirements

The action requires a JSON object with the following properties:

  • prompt: A text description to guide the image generation.
  • mask: (Optional) An image mask for inpainting mode.
  • image: (Optional) An input image for image-to-image transformations.
  • model: Choose between "dev" for detailed outputs or "schnell" for faster results.
  • width & height: Specify dimensions (only if aspect ratio is set to 'custom').
  • numberOfOutputs: Define how many images to generate (maximum of 4).
  • imageOutputFormat: Choose from webp, jpg, or png.
  • additional parameters: Such as prompt intensity, guidance scale, and LoRA application strength.

Expected Output

The output will be a URL link to the generated image(s) based on the input parameters specified.

Use Cases for this specific action

This action is particularly beneficial for:

  • Content Creators: Quickly generating unique visuals for blogs, social media, or digital marketing.
  • Game Developers: Producing character designs or environment art based on specific prompts.
  • Artists: Experimenting with different styles and concepts without the need for manual illustration.
  • E-commerce: Creating product images that stand out in a competitive marketplace.
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 = "85c95403-03f4-46b1-adf3-0adaceb4c5e6" # Action ID for: Generate Image with Mask and Lora Weights

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "model": "dev",
  "prompt": "nep2no in bikini ",
  "enableFastMode": false,
  "imageMegapixels": "1",
  "numberOfOutputs": 1,
  "promptIntensity": 0.8,
  "imageAspectRatio": "1:1",
  "guidanceIntensity": 3,
  "imageOutputFormat": "webp",
  "imageOutputQuality": 80,
  "numberOfInferenceSteps": 28,
  "loraApplicationStrength": 1,
  "additionalLoraApplicationStrength": 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

The "Generate Image with Mask and Lora Weights" action from Nep2no represents a significant advancement in image generation technology. With its robust capabilities, developers can create high-quality, customized images efficiently, opening up a world of possibilities for various applications. Whether you're enhancing your website, developing a game, or creating personalized artwork, this action will streamline your image generation process.

As a next step, consider integrating this action into your projects to explore its full potential and elevate your content creation efforts.