Novelai Python Binding With Pydantic
Project description
novelai-python
The goal of this repository is to use Pydantic to build legitimate requests to access the Novelai API service.
Roadmap 🚧
- /ai/generate-image
- /user/subscription
- /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())
Random Prompt
from novelai_python.utils.random_prompt import RandomPromptGenerator
s = RandomPromptGenerator(nsfw_enabled=False).generate()
print(s)
Run A Server
pip install novelai_python
python3 -m novelai_python.server -h '0.0.0.0' -p 7888
Acknowledgements 🙏
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_python-0.1.8.tar.gz
(28.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file novelai_python-0.1.8.tar.gz.
File metadata
- Download URL: novelai_python-0.1.8.tar.gz
- Upload date:
- Size: 28.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.12.3 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b535ed2122372b49c74391ef5c874fb723b1e91aefc29081fd9ab5fda0299d2c
|
|
| MD5 |
d5ab9f1248a5e9cd7464cc0cb2b2b226
|
|
| BLAKE2b-256 |
cb33ca39c1ef845414edf056235730dfab4d83fb09de1801608979f2ec992fb7
|
File details
Details for the file novelai_python-0.1.8-py3-none-any.whl.
File metadata
- Download URL: novelai_python-0.1.8-py3-none-any.whl
- Upload date:
- Size: 33.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.12.3 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a771ee8dd33b4f8f166839485170046fe4323fdb847819b2ba55ecc538cf6788
|
|
| MD5 |
8f21c3b106f8d3b7da18fd9f5bfb1920
|
|
| BLAKE2b-256 |
398ff21e12ce3a48aff20211add389c9b0374b0f03fe8d987f9c9b6f0741e15b
|