pycurtain


Namepycurtain JSON
Version 0.0.91 PyPI version JSON
download
home_pagehttps://github.com/bin2ai/pycurtain
SummaryA community-maintained Python package for wrapping a variety of REST API calls for different AI art models.
upload_time2023-01-26 03:33:12
maintainer
docs_urlNone
authorbin2ai
requires_python
licenseMIT
keywords art ai deep learning upscaling img2img text2img style transfer rest rest api wrapper ml model gpt open ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.

![](pycurtain.png?raw=true)

# Install

```bash
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.

```python
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

- [x] generate (text2img, creation)
- [x] vary (img2img, style transfer)
- [x] edit (img2img, with masks)
- [x] interrogate (img2text, description)

text

- [x] summarize (tl;dr)
- [x] fix_grammar (punctuation, spelling, capitalization, etc.)
- [x] 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.

- [x] text_to_video_zoom (zoom_in and_out)

<img src="text-to-video-zoom.gif" width="256" height="256"/>

```python
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](https://github.com/bin2ai/pycurtain/blob/main/src/pycurtain/secrete/stuff.py) format.  

No API Key or private information is stored by Pycurtain.

## Sources Offical Sites

- [x] DeepAi SRGAN <https://deepai.org/>
- [x] StabilityAi Stable Diffusion <https://stability.ai/>
- [x] OpenAi Dalle2, GPT3 <https://openai.com/>
- [x] Craiyon (Formally DALL-E Mini) <https://www.craiyon.com/>
- [x] 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:

```bash
pip install -e .[dev]
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bin2ai/pycurtain",
    "name": "pycurtain",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "art,ai,deep learning,upscaling,img2img,text2img,style transfer,rest,rest api,wrapper,ML Model,GPT,Open Ai",
    "author": "bin2ai",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/28/0f/c4b281744c19f89fe7303136feb1e8a89dabb02be41df32f22452ba113f3/pycurtain-0.0.91.tar.gz",
    "platform": null,
    "description": "# Pycurtain\n\nA 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.\n\n![](pycurtain.png?raw=true)\n\n# Install\n\n```bash\npip install pycurtain\n```\n\n# Usage\n\nThere 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.\n\n```python\nimport pycurtain\n\nprint(pycurtain.list_sources())\n''' serial output\n{'image': ['STABLE_DIFFUSION', 'DEEP_AI', 'DALLE2', 'CRAIYON', 'REPLICATE'], 'text': ['GPT3']}\n'''\nprint(pycurtain.list_tasks())\n''' serial output\n{'image': ['edit', 'generate', 'vary', 'upscale'], 'text': ['summarize', 'fix_grammar', 'tag']}\n'''\n\n# first, set your source\nsource = pycurtain.source.SourceImageType.CRAIYON\n# set task to generate\ntask = pycurtain.task.Image(source)\n# set prompt\nprompt = \"a wonderful day\"\n# generate image(s)\nimg = task.generate(prompt=prompt)\n# save image\nimg[0].save(\"output.png\")\n```\n\n## Supported Tasks\n\nimage\n\n- [x] generate (text2img, creation)\n- [x] vary (img2img, style transfer)\n- [x] edit (img2img, with masks)\n- [x] interrogate (img2text, description)\n\ntext\n\n- [x] summarize (tl;dr)\n- [x] fix_grammar (punctuation, spelling, capitalization, etc.)\n- [x] tag (subject matter, genres, subgenres, etc.)\n\n## Supported Processes\n\nA process is a way to combine multiple tasks together.  For example, you can convert a sequence of images into a video.\n\n- [x] text_to_video_zoom (zoom_in and_out)\n\n<img src=\"text-to-video-zoom.gif\" width=\"256\" height=\"256\"/>\n\n```python\nfrom pycurtain.process import text_to_video_zoom\nfrom pycurtain.source import SourceImageType\ntext_to_video_zoom.zoom_in(prompts=[\"A grateful dead poster\"], source=SourceImageType.STABLE_DIFFUSION, n_imgs=10, file_name=\"output.mp4\")\n```\n\n# AI Model Sources\n\nCurrently 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](https://github.com/bin2ai/pycurtain/blob/main/src/pycurtain/secrete/stuff.py) format.  \n\nNo API Key or private information is stored by Pycurtain.\n\n## Sources Offical Sites\n\n- [x] DeepAi SRGAN <https://deepai.org/>\n- [x] StabilityAi Stable Diffusion <https://stability.ai/>\n- [x] OpenAi Dalle2, GPT3 <https://openai.com/>\n- [x] Craiyon (Formally DALL-E Mini) <https://www.craiyon.com/>\n- [x] Replicate <https://replicate.com/>\n\n# Road Map\n\n- provide prelimiary wrappers for these AI model sources\n  - hugging_face <https://huggingface.co/>\n\n- allow users to adjust common parameters between models\n- provide utility features beyond the model wrapper\n  - equirectangluar images (360 degree images)\n  - simple inpainting mask creation\n- beyond images... videos, text, audio.  All leveraging the available REST API accessible ML models of today.\n\n# Developing Pycurtain\n\nTo install pycurtain, along with the tools you need to develop and run test, run the following in your virtual environment:\n\n```bash\npip install -e .[dev]\n```\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A community-maintained Python package for wrapping a variety of REST API calls for different AI art models.",
    "version": "0.0.91",
    "split_keywords": [
        "art",
        "ai",
        "deep learning",
        "upscaling",
        "img2img",
        "text2img",
        "style transfer",
        "rest",
        "rest api",
        "wrapper",
        "ml model",
        "gpt",
        "open ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "786cd79a728727fa38b486dd3b5f9690e35a43a4ad05b99e502a4cce1b9f89a3",
                "md5": "011894078c5ffb19ac767bc9158d16df",
                "sha256": "603b426e018758d02489d240f6963a022cd001699715ed5791c281e6a49867a6"
            },
            "downloads": -1,
            "filename": "pycurtain-0.0.91-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "011894078c5ffb19ac767bc9158d16df",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 18023,
            "upload_time": "2023-01-26T03:33:11",
            "upload_time_iso_8601": "2023-01-26T03:33:11.583538Z",
            "url": "https://files.pythonhosted.org/packages/78/6c/d79a728727fa38b486dd3b5f9690e35a43a4ad05b99e502a4cce1b9f89a3/pycurtain-0.0.91-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "280fc4b281744c19f89fe7303136feb1e8a89dabb02be41df32f22452ba113f3",
                "md5": "47237e9b82b04b588e035b287cd5da79",
                "sha256": "d1ba01f544cf49212742d0852289dd89d05fdd9eccacdfdaa7d5a7f1faa34c36"
            },
            "downloads": -1,
            "filename": "pycurtain-0.0.91.tar.gz",
            "has_sig": false,
            "md5_digest": "47237e9b82b04b588e035b287cd5da79",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 14925,
            "upload_time": "2023-01-26T03:33:12",
            "upload_time_iso_8601": "2023-01-26T03:33:12.686962Z",
            "url": "https://files.pythonhosted.org/packages/28/0f/c4b281744c19f89fe7303136feb1e8a89dabb02be41df32f22452ba113f3/pycurtain-0.0.91.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-26 03:33:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "bin2ai",
    "github_project": "pycurtain",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pycurtain"
}
        
Elapsed time: 0.03843s