create image
Image Generation and Handling
First, send a request to generate an image. You will receive a request_id in the response, which allows you to track the generation status and retrieve the final image.
from zerogpt import ImageClient
client = ImageClient()
request_id = client.create('a beautiful girl')['data']['request_id']With the obtained request_id, retrieve the image.
image = client.get(request_id)
image.download('image.png')In the example above, we used the
download()method to load an image. However, you can preview the image usingimage.open(), which is particularly handy on a computer. Note: Theopen()method doesn't work on mobile devices.
Below is an example of an interactive program that allows users to view and save images upon request:
from zerogpt import ImageClient
client = ImageClient()
request_id = client.create_('a beautiful girl')['data']['request_id']
image = client.get(request_id)
image.open()
if input('save image? (y/n): ').lower() == 'y':
    image.download('image.png')Last updated
