Skip to content

TypeError: replicate_1.default is not a constructor #161

Closed
@fedikan

Description

@fedikan

I've just downloaded your client, and wanted to do some cool AI generations, but seems like it's not possible right now :(
My replicate module version is replicate@0.21.1
Some code example:

import Replicate from "replicate";


import { GeneratedImageResponse } from 'src/types/generated.image.response';
import { IImageGenerator } from './interfaces';

export const ReplicateID = {
  'stable_diffusion_infinite_zoom': 'arielreplicate/stable_diffusion_infinite_zoom:a2527c5074fc0cf9fa6015a40d75d080d1ddf7082fabe142f1ccd882c18fce61'
}

export class ReplicateService implements IImageGenerator {

  constructor() {
    const replicate = new Replicate({
      auth: process.env.REPLICATE_API_TOKEN,
    });

    this.replicate = replicate;
  }
  private replicate

  async generateImage(config: any, model): Promise<GeneratedImageResponse> {
    const output = await this.replicate.run(
      ReplicateID[model],
      {
        input: {
          prompt: config.prompt
        }
      }
    );
    return output
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions