Python API for SD Models

The Python API for stable diffusion series models that allows easier integration into existing applications.

Currently we only support stabilityai/stable-diffusion-xl-base-1.0 for inference.

Requirements

Install the module requests for testing.

python -m pip install requests

Example code

import requests

url = "https://api.neurohero.io/api/v1/image/generation"

payload = {
    "model": "stabilityai/stable-diffusion-xl-base-1.0",
    "prompt": "draw a cat",
    "width": 512,
    "height": 512,
    "seed": 2024,
}
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "Authorization": "Bearer yourAPIkey"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)