Create Stunning Anime Images with the galverse/mama-v2 Cognitive Actions

24 Apr 2025
Create Stunning Anime Images with the galverse/mama-v2 Cognitive Actions

The galverse/mama-v2 API provides developers with powerful Cognitive Actions designed for generating high-quality anime-themed images. By leveraging the Mama ママ 2.0 model, these actions allow you to create images based on textual prompts, bringing characters and themes from Ayaka Ohira’s Shinsei Galverse anime to life. Integrating these pre-built actions into your applications can enhance user experiences and expand creative possibilities.

Prerequisites

Before you can start using the Cognitive Actions from the galverse/mama-v2 API, you'll need to meet some basic requirements:

  • API Key: To authenticate your requests, you'll need an API key from the Cognitive Actions platform. This key should be included in the headers of your API requests.
  • Setup: Ensure you have a working environment for making HTTP requests, such as Python with the requests library.

Cognitive Actions Overview

Generate Anime-themed Image

The Generate Anime-themed Image action allows you to create anime images based on descriptive prompts. This is particularly useful for applications in gaming, storytelling, and creative arts.

Input

The input for this action is structured as follows:

  • seed (integer, optional): Specifies a random seed for reproducibility. Leave blank for a randomized seed.
  • image (string, optional): URI of the input image used in img2img or inpaint mode.
  • width (integer, default: 1024): The width in pixels of the output image.
  • height (integer, default: 1024): The height in pixels of the output image.
  • prompt (string): The main input prompt describing the desired output image.
  • scheduler (string, default: "K_EULER_ANCESTRAL"): Defines the scheduling algorithm to use.
  • guidanceScale (number, default: 6.5): Controls the intensity of classifier-free guidance.
  • loraModelPath (string, default: "galverse/mama-v2"): Path to the LoRA model hosted on Hugging Face.
  • applyWatermark (boolean, default: true): Determines whether a watermark is applied to the generated image.
  • negativePrompt (string, default: contains undesirable elements): A prompt containing elements you want to avoid in the generated image.
  • promptStrength (number, default: 0.8): Determines the balance between the input image and the prompt in img2img mode.
  • numberOfOutputs (integer, default: 1): Specifies how many images to generate.
  • loraAdditiveScale (number, default: 0.9): Adjusts the impact of LoRA model additions.
  • applyGalGrainFilter (boolean, default: true): Applies a grain filter to the image for texture enhancement.
  • numberOfInferenceSteps (integer, default: 35): Specifies the total number of denoising steps.
  • disableImageSafetyChecker (boolean, default: false): Disables the safety checker for generated images.

Example Input:

{
  "seed": 8888,
  "width": 1024,
  "height": 1024,
  "prompt": "fullbody girl looking forward with yellow eyes and with short white hair, red eyeliner , cool face, wearing black and white jacket wearing moon earrings, moon in the background, glitch effect, synthwave style, synthwave lighting, sks, anime style, in the style of galverse",
  "scheduler": "K_EULER_ANCESTRAL",
  "guidanceScale": 6.5,
  "loraModelPath": "galverse/mama-v2",
  "applyWatermark": true,
  "negativePrompt": "nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name, horns, tattoos, out of frame, large_breasts, horns, tattoos, NSFW",
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "loraAdditiveScale": 0.9,
  "applyGalGrainFilter": true,
  "numberOfInferenceSteps": 35
}

Output

The output of this action is typically a URL of the generated image.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/aee49ebb-766d-4809-bb07-f84cef321afc/0bdc3e76-6e57-4b1f-b94e-3071ba697a6c.png"
]

Conceptual Usage Example (Python)

Here’s how you might call the Generate Anime-themed Image action using a conceptual Python code snippet:

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 = "97609598-cc74-4924-a6e5-142cda611b5d"  # Action ID for Generate Anime-themed Image

# Construct the input payload based on the action's requirements
payload = {
    "seed": 8888,
    "width": 1024,
    "height": 1024,
    "prompt": "fullbody girl looking forward with yellow eyes and with short white hair, red eyeliner , cool face, wearing black and white jacket wearing moon earrings, moon in the background, glitch effect, synthwave style, synthwave lighting, sks, anime style, in the style of galverse",
    "scheduler": "K_EULER_ANCESTRAL",
    "guidanceScale": 6.5,
    "loraModelPath": "galverse/mama-v2",
    "applyWatermark": True,
    "negativePrompt": "nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name, horns, tattoos, out of frame, large_breasts, horns, tattoos, NSFW",
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "loraAdditiveScale": 0.9,
    "applyGalGrainFilter": True,
    "numberOfInferenceSteps": 35
}

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, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action_id variable holds the ID for the Generate Anime-themed Image action, and the payload is constructed based on the specified input schema. The endpoint URL is illustrative and should be replaced with the actual endpoint provided by the service.

Conclusion

The galverse/mama-v2 Cognitive Actions offer a fantastic opportunity for developers to integrate creative image generation capabilities into their applications. By utilizing the Generate Anime-themed Image action, you can create stunning visuals that resonate with fans of anime and enhance user engagement. Explore the possibilities and start generating your own anime-themed images today!