This repo contains a "hello world" example demonstrating the how to prompt a machine learning model hosted by Replicate via node.js. This example is for the Programming from A to Z class at ITP, NYU. (Students in the class, contact me for your API key!)
import Replicate from 'replicate';
import * as dotenv from 'dotenv';
dotenv.config();
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
const version = '8e6975e5ed6174911a6ff3d60540dfd4844201974602551e10e9e87ab143d81e';
const model = 'meta/llama-2-7b-chat';
go();
async function go() {
const input = {
prompt: 'Help me with a thesis idea.',
system_prompt: 'You are a student at ITP, Tisch School of the Arts, NYU.',
};
const output = await replicate.run(`${model}:${version}`, { input });
console.log(output.join('').trim());
}
Replicate is a platform for running machine learning models in the cloud from your own code.
Here are a few links to help you explore what is possible with generative AI models.
NOTE: models prefixed with ✨ are currently popular in the community.
- language
- llama-2-7b-chat (small)
- llama-2-13b-chat (medium)
- ✨ llama-2-70b-chat (large)
- code
- codellama-7b-instruct (small)
- codellama-13b-instruct (medium)
- ✨ codellama-34b-instruct (large)
- ✨ SDXL
- ✨ SDXL fine-tunes
- make it emoji! sdxl-emoji
- make it tron! sdxl-tron
- make it 70s wool! sdxl-woolitize
- Stable Diffusion 2.1
- ✨ illusion
- generate tileable images with material_stable_diffusion
- For music, try MusicGen or riffusion
- For voice, try bark or xtts
- For voice transcription, try whisperx
- ✨ Animate Diff
- ✨ Hotshot XL
- Zeroscope v2 -- companion guide: https://zeroscope.replicate.dev/
For detailed usage, setup, and more, here is the official Replicate Documentation for Node.js.