Docs
API
Functions
Image Generation

Generation

This is the description of our different image generation endpoints for the API.

To use just send a text prompt

Image Generation (/generate_image)

This is our base image generation model that runs faster but with less detail.

url = f"https://gateway.ezml.io/api/v1/functions/generate_image"
payload = {
    "text": "dog in space on a hotdog",
    "prompt_focus": 20, # (Optional, default: 15) how close to stick to the prompt. [0, 35] the higher the number the closer to stay to the prompt
}
headers = {
    "Authorization": "Bearer <token from /auth>"
}

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

with open("test.png", "wb") as f: # write resulting image to file
    f.write(base64.b64decode(res["result"]))

Heavy Image Generation (/generate_image_heavy)

This is our most powerful image generation model facilitating immense detail and quality.

url = f"https://gateway.ezml.io/api/v1/functions/generate_image_heavy"
payload = {
    "text": "dog in space on a hotdog",
    "prompt_focus": 20, # (Optional, default: 15) how close to stick to the prompt. [0, 35] the higher the number the closer to stay to the prompt
}
headers = {
    "Authorization": "Bearer <token from /auth>"
}

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

with open("test.png", "wb") as f: # write resulting image to file
    f.write(base64.b64decode(res["result"]))
Last updated on September 12, 2023