Skip to main content

Novelai Python Binding With Pydantic

Project description

novelai-python

PyPI version Downloads

The goal of this repository is to use Pydantic to build legitimate requests to access the Novelai API service.

Roadmap 🚧

  • /ai/generate-image
  • /ai/generate-image/suggest-tags
  • /ai/annotate-image
  • /ai/classify
  • /ai/upscale
  • /ai/generate-prompt
  • /ai/generate
  • /ai/generate-voice

Usage 🖥️

import asyncio
import os

from dotenv import load_dotenv
from pydantic import SecretStr

from novelai_python import GenerateImageInfer, ImageGenerateResp, JwtCredential

load_dotenv()

enhance = "year 2023,dynamic angle,  best quality, amazing quality, very aesthetic, absurdres"


async def main():
    globe_s = JwtCredential(jwt_token=SecretStr(os.getenv("NOVELAI_JWT")))
    _res = await GenerateImageInfer.build(
        prompt=f"1girl,{enhance}").generate(
        session=globe_s)
    _res: ImageGenerateResp
    print(_res.meta)
    file = _res.files[0]
    with open(file[0], "wb") as f:
        f.write(file[1])


loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Acknowledgements 🙏

BackEnd novelai-api

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

novelai_python-0.1.5.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

novelai_python-0.1.5-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file novelai_python-0.1.5.tar.gz.

File metadata

  • Download URL: novelai_python-0.1.5.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.12.2 CPython/3.10.12

File hashes

Hashes for novelai_python-0.1.5.tar.gz
Algorithm Hash digest
SHA256 2e20db23cf9b44dcf82827f3e2367b427d3c41b3894eeecaf0595c971f31136d
MD5 eb2070edfcba4226aad3688fa7e39177
BLAKE2b-256 4ab1485d4a550b01a777db070dc5fee0c74e4b81f686d384f2169ea86578400c

See more details on using hashes here.

File details

Details for the file novelai_python-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: novelai_python-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.12.2 CPython/3.10.12

File hashes

Hashes for novelai_python-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4c9f17a37098b1a33a8f51119baf821d6d3209c02fb230a6a3275e5248426a99
MD5 13a1f4b9ca572b8102e707f86a18cc50
BLAKE2b-256 de370258512b26e256da946df97a3660e81ae4a84c2c3e3227e8069da4f31964

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page