Skip to content

Programming-from-A-to-Z/Replicate-p5js-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using Replicate in Node.js: Streaming ML model responses to p5.js

This repository contains an example demonstrating how to interact with a machine learning model hosted by Replicate via Node.js, using a streaming API to send real-time responses to a p5.js sketch. This example is for the Programming from A to Z class at ITP, NYU. (Students in the class, contact me for your API key!)

In this example, the p5.js client receives streamed responses, simulating a "bot" typing effect in real-time.

Replicate

Replicate is a platform for running machine learning models in the cloud from your own code. Browse models.

For detailed usage, setup, and more, here is the official Replicate Documentation for Node.js.

Replicate Streaming API

The project utilizes Replicate's streaming API to receive real-time outputs from a machine learning model. The server sets up a connection using the EventSource interface, enabling it to handle streamed data from the model and forward it to the p5.js client.

Replicate

Replicate is a platform for running machine learning models in the cloud from your code. Browse models.

For more on using the streaming API and setting up your environment, refer to the official Replicate Documentation for Node.js.

About

Demonstrating Streaming the replies from the model

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published