FireHead90544 / craiyon.py

Unofficial API Wrapper for craiyon.com (DAL-E-MINI). Generate awesome images from text tokens.
Apache License 2.0
69 stars 22 forks source link

v2 #9

Closed lonardonifabio closed 1 year ago

lonardonifabio commented 1 year ago

What do i have to modify in order to use the V2 model?

`from craiyon import Craiyon from PIL import Image from io import BytesIO import streamlit as st import base64

def Generate(request): generator = Craiyon() # Instantiates the api wrapper result = generator.generate(request) # Generates 9 images by default images = result.images return images

generator = Craiyon() request = "a dragon on a motorbike" image_files = Generate(request) st.image(Image.open(BytesIO(base64.decodebytes(image_files[0].encode("utf-8")))))`

mdm9300404 commented 1 year ago

Hi, I would suggest keeping your old code for now, as Craiyon just released their v3 model, and completely deleted the endpoint for the v2 model. The only model that works with craiyon.py at the moment is v1.

We are working to add v3 support hopefully sometime soon.

FireHead90544 commented 1 year ago

You may use the v3 model now by just importing the Craiyon class, the new v1.0.0 has been released on PyPI.