High-level async API for NovelAI image generation
Project description
NovelAI-API
A lightweight asynchronous Python wrapper for the NovelAI image generation API supporting both web and api backend.
Installation
pip install novelai
Usage
Initialization
import asyncio
from novelai import NAIClient
# Replace string values with your actual account credentials
username = "Your NovelAI username"
password = "Your NovelAI password"
async def main():
client = NAIClient(username, password, proxy=None)
await client.init()
asyncio.run(main())
Generate
from pathlib import Path
async def main():
# Choose host between "api" and "web"
output = await client.generate_image(prompt="1girl", host="api")
path = Path("output")
path.mkdir(parents=True, exist_ok=True)
for filename, data in output.items():
Path(path / filename).write_bytes(data)
asyncio.run(main())
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
novelai-0.0.1.tar.gz
(10.6 kB
view hashes)