Skip to main content

photo (4)

VisionCraft API

Fully async python wrapper for VisionCraft API

Installing

pip install VisionCraftAPI

Features

  • Fully async methods
  • Important methods return Pydantic model as result for easier interaction with data
  • Full exception handling
  • Full documentation is available

Usage

import asyncio
import aiohttp

from VisionCraftAPI import VisionCraftClient

async def generate_xl_image(client: VisionCraftClient,
                            prompt: str,
                            model: str,
                            sampler: str,
                            image_count: int):
    images = await client.generate_xl_image(
        prompt=prompt,
        model=model,
        sampler=sampler,
        image_count=image_count
    )
    
    print('Images generated! Saving it...')
    # Download and save the generated images
    async with aiohttp.ClientSession() as session:
        for i, image_url in enumerate(images):
            async with session.get(image_url) as image_response:
                image_data = await image_response.read()
                # Save the image locally
                with open(f"generated_image_{i}.png", "wb") as f:
                    f.write(image_data)
                    
async def main():
    # Set your API key
    api_key = "YOUR_API_KEY"
    # Create a VisionCraftClient instance
    client = VisionCraftClient(api_key=api_key)
    
    # Get all SDXL models and samplers
    models = await client.get_xl_models()
    samplers = await client.get_xl_samplers()

    # Generate an image with the first model and sampler
    await generate_xl_image(client=client,
                            prompt='A beautiful sunset',
                            model=models[0],
                            sampler=samplers[0],
                            image_count=4)
            
if __name__ == '__main__':
    asyncio.run(main())

Docs

Go to https://vision.b2k.tech/ for more information about SDK

Metadata

Release files for VisionCraftAPI 1.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for VisionCraftAPI 1.0.8
File Size Uploaded Provenance Actions
visioncraftapi-1.0.8.tar.gz 10.1 kB Without provenance Details for visioncraftapi-1.0.8.tar.gz

Release files / visioncraftapi-1.0.8.tar.gz

Download URL visioncraftapi-1.0.8.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8c5e5b8d4ce643afe96e0a44a75f839f456db61224800ea7a35b0216081a1184
BLAKE2b-256 checksum
How to use checksums
5fe82f7c170a0292ed9ea1e05d1ee6e0aa2eedef022c6b1b1c377b090570ef3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Security for VisionCraftAPI 1.0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page