JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 148
  • Score
    100M100P100Q75474F
  • License MIT

A Node.js client for Replicate.

Package Exports

  • node-replicate
  • node-replicate/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-replicate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-replicate

A Node.js client for Replicate.

import replicate from "node-replicate"
const model = "owner/model:version"
const input = { prompt: "an astronaut riding on a horse" }

await replicate.run(model, input)

Introduction

Replicate is an online platform for running machine learning models in the cloud. This package implements a lightweight client for their anonymous API, allowing you to run Stable Diffusion, Whisper and other cutting-edge models in just a few lines of code 😄🤏.

Features

  • Anonymous API 👻.
  • Lightweight - only 30 lines of code 🔥.

Installation

Install with npm.

npm i node-replicate

Usage

To run a model, just pass its identifier and prediction parameters to replicate.run().

const model = "owner/model:version"
const input = { prompt: "an astronaut riding on a horse" }

await replicate.run(model, input)

You can also monitor pending predictions with replicate.create().

let prediction = await replicate.create(model, input)

prediction = await replicate.get(prediction)

Once the prediction has succeeded, prediction.status will be set to "succeeded".

Contributing

Have a feature you'd like to see added? Create a pull request or open an issue.