generate_xl_image

Generate an image using StableDiffusion XL models

SDK Method

async def generate_xl_image(prompt, model, sampler, width=1024, height=1024,
negative_prompt="", cfg_scale=10, steps=30) -> bytes

Usage example

from VisionCraftAPI import VisionCraftClient

async def main():
    # Set your API key
    api_key = "YOUR_API_KEY"
    
    # Create a VisionCraftClient instance
    client = VisionCraftClient(api_key=api_key)
    
    # Generate an image with the SDXL model and sampler
    image = await client.generate_xl_image(
        prompt='A beautiful sunset',
        model='sdxl-base',
        sampler='euler',
    )
    
    # Save image to the current directory
    with open("generated_image.png", "wb") as f:
        f.write(image)
    
if __name__ == '__main__':
    import asyncio
    asyncio.run(main())

For further information go to API Docs

Last updated