v2
lonardonifabio opened this issue · 2 comments
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")))))`
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.
You may use the v3 model now by just importing the Craiyon
class, the new v1.0.0 has been released on PyPI.