Pycurtain
A community-maintained python package for wrapping REST APIs that interface with a variety of different AI models. Think "curtain", like wizard of oz behind the curtain. This tool lets the developer close the curtains and only focus on implementing one code base for any supported AI models.
Install
pip install pycurtain
Usage
There are tasks (image-related) and sources (AI art models) that are supported. The following is an example of how to use the package to generate an image from a model source.
import pycurtain
print(pycurtain.list_sources())
''' serial output
{'image': ['STABLE_DIFFUSION', 'DEEP_AI', 'DALLE2', 'CRAIYON', 'REPLICATE'], 'text': ['GPT3']}
'''
print(pycurtain.list_tasks())
''' serial output
{'image': ['edit', 'generate', 'vary', 'upscale'], 'text': ['summarize', 'fix_grammar', 'tag']}
'''
# first, set your source
source = pycurtain.source.SourceImageType.CRAIYON
# set task to generate
task = pycurtain.task.Image(source)
# set prompt
prompt = "a wonderful day"
# generate image(s)
img = task.generate(prompt=prompt)
# save image
img[0].save("output.png")
Supported Tasks
image
- generate (text2img, creation)
- vary (img2img, style transfer)
- edit (img2img, with masks)
- interrogate (img2text, description)
text
- summarize (tl;dr)
- fix_grammar (punctuation, spelling, capitalization, etc.)
- tag (subject matter, genres, subgenres, etc.)
Supported Processes
A process is a way to combine multiple tasks together. For example, you can convert a sequence of images into a video.
- text_to_video_zoom (zoom_in and_out)
from pycurtain.process import text_to_video_zoom
from pycurtain.source import SourceImageType
text_to_video_zoom.zoom_in(prompts=["A grateful dead poster"], source=SourceImageType.STABLE_DIFFUSION, n_imgs=10, file_name="output.mp4")
AI Model Sources
Currently all but one supported AI Models require an API key generated from the REST API host (Craiyon being the exception). Pycurtain is a third-party (open-source / community driven) python wrapper SDK and is not associated with any of the AI Model providers. Each API key can be generated by signing up from the AI Model hosting site. The current implementation requires each (in-use) API key to be set in the environment variables following the \secrets\stuff.py format.
No API Key or private information is stored by Pycurtain.
Sources Offical Sites
- DeepAi SRGAN https://deepai.org/
- StabilityAi Stable Diffusion https://stability.ai/
- OpenAi Dalle2, GPT3 https://openai.com/
- Craiyon (Formally DALL-E Mini) https://www.craiyon.com/
- Replicate https://replicate.com/
Road Map
-
provide prelimiary wrappers for these AI model sources
- hugging_face https://huggingface.co/
-
allow users to adjust common parameters between models
-
provide utility features beyond the model wrapper
- equirectangluar images (360 degree images)
- simple inpainting mask creation
-
beyond images... videos, text, audio. All leveraging the available REST API accessible ML models of today.
Developing Pycurtain
To install pycurtain, along with the tools you need to develop and run test, run the following in your virtual environment:
pip install -e .[dev]
Metadata
Release files for pycurtain 0.0.91
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pycurtain-0.0.91.tar.gz | 14.9 kB | Without provenance | Details for pycurtain-0.0.91.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pycurtain-0.0.91-py3-none-any.whl | Python 3 | none | any | Details for pycurtain-0.0.91-py3-none-any.whl |
Total release size: 32.9 kB
Release files / pycurtain-0.0.91.tar.gz
| Download URL | pycurtain-0.0.91.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1ba01f544cf49212742d0852289dd89d05fdd9eccacdfdaa7d5a7f1faa34c36
|
|
BLAKE2b-256 checksum How to use checksums |
280fc4b281744c19f89fe7303136feb1e8a89dabb02be41df32f22452ba113f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / pycurtain-0.0.91-py3-none-any.whl
| Download URL | pycurtain-0.0.91-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
603b426e018758d02489d240f6963a022cd001699715ed5791c281e6a49867a6
|
|
BLAKE2b-256 checksum How to use checksums |
786cd79a728727fa38b486dd3b5f9690e35a43a4ad05b99e502a4cce1b9f89a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for pycurtain 0.0.91
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.