Dalle image generation progression

Is it possible to calculate the progress of a dalle generated image for use with a loading bar? I can see that chatGPT returns a small circle loader while the image is being generated, however, I can’t see how to reproduce this in the docs?

NodeJS code I’m using…

  public generateImage(
    description: string,
    userUID: string,
  ): Observable<string> {
    return new Observable((subscriber) => {
      this._client.images
        .generate({
          model: this._models.image,
          prompt: this.getImagePrompt(description),
          size: '1024x1024',
          style: 'vivid',
          user: userUID,
        })
        .then((result) => {
          // Notify subscribers of the result
          subscriber.next(result.data[0].url);
          subscriber.complete();
        })
        .catch((error: OpenAIError) => {
          subscriber.error(error.message);
        });
    });
  }

The image API returns no information until you get a response.

You will notice in ChatGPT that the progress indicator is pessimistic, and makes its way about 40% before an image is produced. It is just an animation, a script updates an SVG, and an animated GIF to just indicate thinking activity could stand in.

1 Like