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.4.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

novelai_python-0.1.4-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: novelai_python-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 f8f4b1824b35630aa3042a4212ee93de9663a21fca563aa506ca3eef9867c975
MD5 192b775b5355847e86fd180ff0d2f7e2
BLAKE2b-256 b06219d16d4d9c0deb58b1deff3a19f149a0240220bf3ef9db9b8792f1521a7c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: novelai_python-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 28.5 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6b84e99deb03a8c57525e1e22c4d6975bb668c3ecd127efce93e0ba289ffc75e
MD5 3edbeafe982bdbcd362cca88288ab256
BLAKE2b-256 fcda02b63791b376f7e7d5ac608457293f0e06f27b15212b6991520e8886500e

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