typetext
{
"clip_skip": 0,
"eta": 0,
"guidance_scale": 1,
"height": 1024,
"num_images": 1,
"prompt": "A man with hoodie on, illustration",
"seed": 1234,
"steps": 4,
"width": 1024
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Bqq**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
import fs from "node:fs";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run jyoung105/slam using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"jyoung105/slam:1197108fbd7ca3fd9a52a718c6958b869adc666f24647081d594f0c00af078cc",
{
input: {
clip_skip: 0,
eta: 0,
guidance_scale: 1,
height: 1024,
num_images: 1,
prompt: "A man with hoodie on, illustration",
seed: 1234,
steps: 4,
width: 1024
}
}
);
// To access the file URL:
console.log(output[0].url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output[0]);
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_Bqq**********************************
This is your API token. Keep it to yourself.
import replicate
Run jyoung105/slam using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"jyoung105/slam:1197108fbd7ca3fd9a52a718c6958b869adc666f24647081d594f0c00af078cc",
input={
"clip_skip": 0,
"eta": 0,
"guidance_scale": 1,
"height": 1024,
"num_images": 1,
"prompt": "A man with hoodie on, illustration",
"seed": 1234,
"steps": 4,
"width": 1024
}
)
# To access the file URL:
print(output[0].url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output[0].read())
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Bqq**********************************
This is your API token. Keep it to yourself.
Run jyoung105/slam 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": "jyoung105/slam:1197108fbd7ca3fd9a52a718c6958b869adc666f24647081d594f0c00af078cc",
"input": {
"clip_skip": 0,
"eta": 0,
"guidance_scale": 1,
"height": 1024,
"num_images": 1,
"prompt": "A man with hoodie on, illustration",
"seed": 1234,
"steps": 4,
"width": 1024
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "5wxhxp0w15rma0ckag59hwkxaw",
"model": "jyoung105/slam",
"version": "1197108fbd7ca3fd9a52a718c6958b869adc666f24647081d594f0c00af078cc",
"input": {
"clip_skip": 0,
"eta": 0,
"guidance_scale": 1,
"height": 1024,
"num_images": 1,
"prompt": "A man with hoodie on, illustration",
"seed": 1234,
"steps": 4,
"width": 1024
},
"logs": "[Debug] DEVICE: cuda\n[Debug] DTYPE: torch.float16\nSetup completed in 0.00 seconds.\n[~] Generating images...\n[Debug] Prompt: A man with hoodie on, illustration, best quality, high detail, sharp focus\n[Debug] Seed: 1234\n 0%| | 0/4 [00:00<?, ?it/s]\n 25%|██▌ | 1/4 [00:00<00:00, 5.48it/s]\n 75%|███████▌ | 3/4 [00:00<00:00, 10.81it/s]\n100%|██████████| 4/4 [00:00<00:00, 10.89it/s]\nImage generation completed in 1.19 seconds.\n[~] GPU: NVIDIA L40S\n[~] Memory: 11.04 GiB / 44.99 GiB\n[~] Generation time: 1.19 seconds",
"output": [
"https://replicate.delivery/xezq/e9IdbIjQLm2ICC7wljoQDsagycArgYlZEnf8VGQyIzne9GnnA/out_0.png"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-11-22T13:22:48.969Z",
"started_at": "2024-11-22T13:23:08.57451Z",
"completed_at": "2024-11-22T13:23:10.119012Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/5wxhxp0w15rma0ckag59hwkxaw/cancel",
"get": "https://api.replicate.com/v1/predictions/5wxhxp0w15rma0ckag59hwkxaw",
"stream": "https://stream.replicate.com/v1/files/bcwr-n63jegwqr2ey5t45ijxaxovmh5ga76iyrl2x6ekwbvkfcalcynsa",
"web": "https://replicate.com/p/5wxhxp0w15rma0ckag59hwkxaw"
},
"metrics": {
"predict_time": 1.544502077,
"total_time": 21.150012
}
}