saharmor / dalle-playground

A playground to generate images from any text prompt using Stable Diffusion (past: using DALL-E Mini)
MIT License
2.77k stars 596 forks source link

images output format changed #92

Closed dcsan closed 2 years ago

dcsan commented 2 years ago

just in case anyone else hit this.

my service that was pulling from dall-e mini model seems to now get images in jpeg format, and the response structure changed.

I guess this change? https://github.com/saharmor/dalle-playground/commit/cad1753193ed15c06c6dddc076d0f5d4a04653a7

I'm using node server side to extract, so now extract these fields

    let images, parsed, format

    try {
        // @ts-ignore
        parsed = JsonBigint.parse(response)
        images = parsed.generatedImgs
        format = parsed.generatedImgsFormat // seems to switch between 'png' and 'jpg'
        if (!images) {
            clog.error('cannot parse images from response', { response, data: parsed })
            throw Error('cannot parse images from response')
        }
    } catch (error) {
        clog.error('expection on parsing dalle response', { error, response, data: parsed })
    }
saharmor commented 2 years ago

@dcsan that's correct, sorry for the breaking changes. I had to add an extra variable while the response was only a json-version of thegeneratedImgs list.