Giter Site home page Giter Site logo

fischuu / craiyon.py Goto Github PK

View Code? Open in Web Editor NEW

This project forked from firehead90544/craiyon.py

0.0 0.0 0.0 12 KB

Unofficial API Wrapper for craiyon.com (DAL-E-MINI). Generate awesome images from text tokens.

License: Apache License 2.0

Python 100.00%

craiyon.py's Introduction

craiyon.py

API Wrapper for craiyon (formerly DAL-E-MINI) to generate awesome images from text tokens.

Badges

Provided By: shields.io

PyPI Version PyPI Downloads Apache License 2.0 Connect On Discord Code Lines Code Size Pull Requests Issues Contributors

Acknowledgements

Authors

Installation

The easiest way to install craiyon.py is using pip

  pip install -U craiyon.py

Or just manually clone the repository and build the wheel

Usage / Examples

Generate and save the images

from craiyon import Craiyon

generator = Craiyon() # Instantiates the api wrapper
result = generator.generate("Photorealistic image of shrek eating earth")
result.save_images() # Saves the generated images to 'current working directory/generated', you can also provide a custom path

image

Use the images in your code without saving

from craiyon import Craiyon
from PIL import Image # pip install pillow
from io import BytesIO
import base64

generator = Craiyon() # Instantiates the api wrapper
result = generator.generate("Professional photo of Obama flashing a flag with his last name") # Generates 9 images by default and you cannot change that
images = result.images # A list containing image data as base64 encoded strings
for i in images:
    image = Image.open(BytesIO(base64.decodebytes(i.encode("utf-8"))))
    # Use the PIL's Image object as per your needs

image

Todo

  • Build an async wrapper which is non-blocking and can be used with async code (e.g. aiohttp, discord.py)

Contributing

Contributions are always welcome!

  • Fork this repository.
  • Make the changes in your forked repositry.
  • Make sure to fetch upstream before generating a PR.
  • Generate a pull request.

Please adhere to the GitHub's code of conduct for contributions and contributors.

License

Apache License 2.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.