typetext
{
"height": 768,
"negative_prompt": "",
"number_of_images": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "portrait photo with neon green hair, motion blur, rapid movement",
"width": 768
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_dOo**********************************
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 sdxl-based/realistic-vision-hyper using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"sdxl-based/realistic-vision-hyper:9194e2f965e67804438b928bc616496ca61abdd9f3e66f1f23b4b5b81a83b4e7",
{
input: {
height: 768,
negative_prompt: "",
number_of_images: 1,
output_format: "webp",
output_quality: 80,
prompt: "portrait photo with neon green hair, motion blur, rapid movement",
width: 768
}
}
);
// 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_dOo**********************************
This is your API token. Keep it to yourself.
import replicate
Run sdxl-based/realistic-vision-hyper using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"sdxl-based/realistic-vision-hyper:9194e2f965e67804438b928bc616496ca61abdd9f3e66f1f23b4b5b81a83b4e7",
input={
"height": 768,
"negative_prompt": "",
"number_of_images": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "portrait photo with neon green hair, motion blur, rapid movement",
"width": 768
}
)
# 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_dOo**********************************
This is your API token. Keep it to yourself.
Run sdxl-based/realistic-vision-hyper 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": "sdxl-based/realistic-vision-hyper:9194e2f965e67804438b928bc616496ca61abdd9f3e66f1f23b4b5b81a83b4e7",
"input": {
"height": 768,
"negative_prompt": "",
"number_of_images": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "portrait photo with neon green hair, motion blur, rapid movement",
"width": 768
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "n7yhs2dz2hrgp0cfwfrtcrnxvw",
"model": "sdxl-based/realistic-vision-hyper",
"version": "9194e2f965e67804438b928bc616496ca61abdd9f3e66f1f23b4b5b81a83b4e7",
"input": {
"height": 768,
"negative_prompt": "",
"number_of_images": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "portrait photo with neon green hair, motion blur, rapid movement",
"width": 768
},
"logs": "Random seed set to: 2340238831\nRunning workflow\ngot prompt\nExecuting node 3, title: KSampler, class type: KSampler\n 0%| | 0/6 [00:00<?, ?it/s]\n 17%|█▋ | 1/6 [00:00<00:00, 5.84it/s]\n 33%|███▎ | 2/6 [00:00<00:00, 5.72it/s]\n 50%|█████ | 3/6 [00:00<00:00, 5.72it/s]\n 67%|██████▋ | 4/6 [00:00<00:00, 5.55it/s]\n 83%|████████▎ | 5/6 [00:00<00:00, 5.63it/s]\n100%|██████████| 6/6 [00:00<00:00, 6.20it/s]\nExecuting node 8, title: VAE Decode, class type: VAEDecode\nExecuting node 9, title: Save Image, class type: SaveImage\nPrompt executed in 1.21 seconds\noutputs: {'9': {'images': [{'filename': 'R8__00001_.png', 'subfolder': '', 'type': 'output'}]}}\n====================================\nR8__00001_.png",
"output": [
"https://replicate.delivery/pbxt/V8JJAwYe6nV2b6vmOjQuFugPAukrxblvntRWAxaDuDrfmO7SA/R8__00001_.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-06-04T15:50:22.228Z",
"started_at": "2024-06-04T15:50:22.2641Z",
"completed_at": "2024-06-04T15:50:24.790771Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/n7yhs2dz2hrgp0cfwfrtcrnxvw/cancel",
"get": "https://api.replicate.com/v1/predictions/n7yhs2dz2hrgp0cfwfrtcrnxvw",
"web": "https://replicate.com/p/n7yhs2dz2hrgp0cfwfrtcrnxvw"
},
"metrics": {
"predict_time": 2.526671,
"total_time": 2.562771
}
}