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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

novelai_python-0.1.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: novelai_python-0.1.1.tar.gz
  • Upload date:
  • Size: 7.6 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.1.tar.gz
Algorithm Hash digest
SHA256 62fe35bc0bc81859ac1a2d04036968adbbfe520ccf1472a111a4f58b4577d604
MD5 303861c971dce04aa96a71b3f7d51f34
BLAKE2b-256 daf0a6774d0bbb8c69c3febf9da72aeebae73cba4c83444e35397a48791bfa38

See more details on using hashes here.

File details

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

File metadata

  • Download URL: novelai_python-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a740df1b38b0982254126149a933de6b7b5ba76e76c06cab9a106ccf116e5be
MD5 cf9f0af40d157dafc7dc8141fe0db6ce
BLAKE2b-256 12e59a22f82bd0fe07a390d2bb8af67d2f00987fff45fb356abcd0515087be0f

See more details on using hashes here.

Supported by

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