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

How to use upscale feature? #14

Open TexturedPolak opened 1 year ago

TexturedPolak commented 1 year ago

Przechwycenie obrazu ekranu_2023-07-07_13-34-33

FireHead90544 commented 1 year ago

Until yet, I haven't implemented the upscale feature. Will be doing so pretty soon.

FireHead90544 commented 1 year ago

It is still yet to be implemented. I'll be doing it some time later, until then if anyone would like to implement it, here's the info you'd require.

Upscale

ENDPOINT: https://api.craiyon.com/upscale

Payload Format:

{"image_id": "date/imagepath.ext", "model": "none", "negative_prompt": "", "prompt": "", "token": "null", "version": "c4ue22fb7kb6wlac"}

Upscaled Image: "https://pics.craiyon.com/" + resp.json()["images"][0]

Keep it as a separate entity (function) inside the Craiyon class, so that we could upscale by invoking something like

generator = Craiyon()
image = generator.upscale("2023-08-21/de9e76d570eb496086afa71979a11706.webp") # <-- This would be a link
TexturedPolak commented 1 year ago

Oh, thanks, maybe I'm do it :)

TexturedPolak commented 1 year ago

But you can give me link to API reference (for api.craiyon.com? That's helpfull know what is image_id etc.

FireHead90544 commented 1 year ago

But you can give me link to API reference (for api.craiyon.com? That's helpfull know what is image_id etc.

There isn't any API reference provided by them. All you could find is by surfing the network usage of the website. The image_id is the path to the image resource on craiyon's cdn generated when a prompt is entered and image is generated.

Basically, the 9 images generated by craiyon.

generator = Craiyon()
result = generator.generate("cool apple")
image_ids = [i.replace("https://img.craiyon.com/") for i in result.images]

Here image_ids would be a list of image ifs that can be used as Upscale endpoint's payload.

TexturedPolak commented 1 year ago

Ok, thanks :)