typefile
{
"image_pth": "https://replicate.delivery/pbxt/LHPvcPuhfaOKc7awWZemVvQbg1LfBXLe1cSchjPaokW8az79/Screenshot%202024-02-23%20at%206.54.08%E2%80%AFAM.jpg"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_WdM**********************************
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 qr2ai/prompt_generator using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"qr2ai/prompt_generator:410afb326b6bec9988701a47f004e8bfddea90587d2fd2c5e5ead6ddddc2d56b",
{
input: {
image_pth: "https://replicate.delivery/pbxt/LHPvcPuhfaOKc7awWZemVvQbg1LfBXLe1cSchjPaokW8az79/Screenshot%202024-02-23%20at%206.54.08%E2%80%AFAM.jpg"
}
}
);
// To access the file URL:
console.log(output.url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", 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_WdM**********************************
This is your API token. Keep it to yourself.
import replicate
Run qr2ai/prompt_generator using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"qr2ai/prompt_generator:410afb326b6bec9988701a47f004e8bfddea90587d2fd2c5e5ead6ddddc2d56b",
input={
"image_pth": "https://replicate.delivery/pbxt/LHPvcPuhfaOKc7awWZemVvQbg1LfBXLe1cSchjPaokW8az79/Screenshot%202024-02-23%20at%206.54.08%E2%80%AFAM.jpg"
}
)
# To access the file URL:
print(output.url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output.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_WdM**********************************
This is your API token. Keep it to yourself.
Run qr2ai/prompt_generator 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": "qr2ai/prompt_generator:410afb326b6bec9988701a47f004e8bfddea90587d2fd2c5e5ead6ddddc2d56b",
"input": {
"image_pth": "https://replicate.delivery/pbxt/LHPvcPuhfaOKc7awWZemVvQbg1LfBXLe1cSchjPaokW8az79/Screenshot%202024-02-23%20at%206.54.08%E2%80%AFAM.jpg"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "164p8360xsrgj0cgqmftk7bc34",
"model": "qr2ai/prompt_generator",
"version": "410afb326b6bec9988701a47f004e8bfddea90587d2fd2c5e5ead6ddddc2d56b",
"input": {
"image_pth": "https://replicate.delivery/pbxt/LHPvcPuhfaOKc7awWZemVvQbg1LfBXLe1cSchjPaokW8az79/Screenshot%202024-02-23%20at%206.54.08%E2%80%AFAM.jpg"
},
"logs": "0%| | 0/30 [00:00<?, ?it/s]\n 3%|▎ | 1/30 [00:01<00:49, 1.71s/it]\n 7%|▋ | 2/30 [00:01<00:22, 1.25it/s]\n 10%|█ | 3/30 [00:02<00:14, 1.87it/s]\n 13%|█▎ | 4/30 [00:02<00:10, 2.58it/s]\n 17%|█▋ | 5/30 [00:02<00:07, 3.28it/s]\n 20%|██ | 6/30 [00:02<00:06, 3.91it/s]\n 23%|██▎ | 7/30 [00:02<00:05, 4.47it/s]\n 27%|██▋ | 8/30 [00:02<00:04, 4.92it/s]\n 30%|███ | 9/30 [00:03<00:03, 5.27it/s]\n 33%|███▎ | 10/30 [00:03<00:03, 5.53it/s]\n 37%|███▋ | 11/30 [00:03<00:03, 5.75it/s]\n 40%|████ | 12/30 [00:03<00:03, 5.91it/s]\n 43%|████▎ | 13/30 [00:03<00:02, 6.00it/s]\n 47%|████▋ | 14/30 [00:03<00:02, 6.10it/s]\n 50%|█████ | 15/30 [00:04<00:02, 6.16it/s]\n 53%|█████▎ | 16/30 [00:04<00:02, 6.20it/s]\n 57%|█████▋ | 17/30 [00:04<00:02, 6.19it/s]\n 60%|██████ | 18/30 [00:04<00:01, 6.20it/s]\n 63%|██████▎ | 19/30 [00:04<00:01, 6.22it/s]\n 67%|██████▋ | 20/30 [00:04<00:01, 6.23it/s]\n 70%|███████ | 21/30 [00:04<00:01, 6.22it/s]\n 73%|███████▎ | 22/30 [00:05<00:01, 6.24it/s]\n 77%|███████▋ | 23/30 [00:05<00:01, 6.26it/s]\n 80%|████████ | 24/30 [00:05<00:00, 6.07it/s]\n 83%|████████▎ | 25/30 [00:05<00:00, 6.11it/s]\n 87%|████████▋ | 26/30 [00:05<00:00, 6.15it/s]\n 90%|█████████ | 27/30 [00:05<00:00, 6.20it/s]\n 93%|█████████▎| 28/30 [00:06<00:00, 6.23it/s]\n 97%|█████████▋| 29/30 [00:06<00:00, 6.22it/s]\n100%|██████████| 30/30 [00:06<00:00, 6.18it/s]\n100%|██████████| 30/30 [00:06<00:00, 4.67it/s]",
"output": "https://replicate.delivery/pbxt/IVtXFD8mb87gJ5KL1exysRARrrln19ApB7u6leqjcmzXOIJTA/high_res_output.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-07-16T19:58:13.23Z",
"started_at": "2024-07-16T20:01:06.569385Z",
"completed_at": "2024-07-16T20:01:27.564681Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/164p8360xsrgj0cgqmftk7bc34/cancel",
"get": "https://api.replicate.com/v1/predictions/164p8360xsrgj0cgqmftk7bc34",
"web": "https://replicate.com/p/164p8360xsrgj0cgqmftk7bc34"
},
"metrics": {
"predict_time": 20.995296208,
"total_time": 194.334681
}
}
