Skip to content

fix types for the run() method #368

@gianpaj

Description

@gianpaj

I shouldn't have to write all of this code.

interface ReplicateOutput {
  url: () => string;
  blob: () => Promise<Blob>;
}
interface ReplicateError {
  error?: string;
}
type ReplicateResponse = ReplicateOutput | ReplicateError;

const output = (await replicate.run(
  model,
  {
    input,
  },
  onProgress,
)) as ReplicateResponse;

const outputUrl = (output as ReplicateOutput).url();

const audioBuffer = await (output as ReplicateOutput).blob();

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