defaultWorld
typetext
{
"name": "World"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Bf0**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run mattt/concurrent-hello-world using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"mattt/concurrent-hello-world:b496bea9fabf0c2a55baaf9c1e68c01cf09feb46176eaf11956361a414545708",
{
input: {
name: "World"
}
}
);
console.log(output);
To learn more, take a look at the guide on getting started with Node.js.
pip install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Bf0**********************************
This is your API token. Keep it to yourself.
import replicate
Run mattt/concurrent-hello-world using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"mattt/concurrent-hello-world:b496bea9fabf0c2a55baaf9c1e68c01cf09feb46176eaf11956361a414545708",
input={
"name": "World"
}
)
# The mattt/concurrent-hello-world model can stream output as it's running.
# The predict method returns an iterator, and you can iterate over that output.
for item in output:
# https://replicate.com/mattt/concurrent-hello-world/api#output-schema
print(item)
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Bf0**********************************
This is your API token. Keep it to yourself.
Run mattt/concurrent-hello-world using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Prefer: wait" \
-d $'{
"version": "mattt/concurrent-hello-world:b496bea9fabf0c2a55baaf9c1e68c01cf09feb46176eaf11956361a414545708",
"input": {
"name": "World"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
hello World (#9)
{
"id": "gsrv52rbxbqbubh7ov36l5ns4y",
"model": "mattt/concurrent-hello-world",
"version": "b496bea9fabf0c2a55baaf9c1e68c01cf09feb46176eaf11956361a414545708",
"input": {
"name": "World"
},
"logs": "",
"output": [
"hello World (#0)",
"hello World (#1)",
"hello World (#2)",
"hello World (#3)",
"hello World (#4)",
"hello World (#5)",
"hello World (#6)",
"hello World (#7)",
"hello World (#8)",
"hello World (#9)"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-02-06T22:59:59.10347Z",
"started_at": "2024-02-06T22:59:59.107675Z",
"completed_at": "2024-02-06T23:00:10.090913Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/gsrv52rbxbqbubh7ov36l5ns4y/cancel",
"get": "https://api.replicate.com/v1/predictions/gsrv52rbxbqbubh7ov36l5ns4y"
},
"metrics": {
"predict_time": 10.983238,
"total_time": 10.987443
}
}