typetext
{
"aspect_ratio": "16:9",
"image_reference_weight": 0.85,
"prompt": "A train car is engulfed in a massive explosion, with flames and smoke billowing into the sky as debris flies in all directions, cinematic photograph, explosive action, high contrast, dynamic lighting.",
"style_reference_weight": 0.85
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_LpX**********************************
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 luma/photon-flash using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "16:9",
image_reference_weight: 0.85,
prompt: "A train car is engulfed in a massive explosion, with flames and smoke billowing into the sky as debris flies in all directions, cinematic photograph, explosive action, high contrast, dynamic lighting.",
style_reference_weight: 0.85
};
const output = await replicate.run("luma/photon-flash", { input });
// 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_LpX**********************************
This is your API token. Keep it to yourself.
import replicate
Run luma/photon-flash using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"luma/photon-flash",
input={
"aspect_ratio": "16:9",
"image_reference_weight": 0.85,
"prompt": "A train car is engulfed in a massive explosion, with flames and smoke billowing into the sky as debris flies in all directions, cinematic photograph, explosive action, high contrast, dynamic lighting.",
"style_reference_weight": 0.85
}
)
# 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_LpX**********************************
This is your API token. Keep it to yourself.
Run luma/photon-flash 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 $'{
"input": {
"aspect_ratio": "16:9",
"image_reference_weight": 0.85,
"prompt": "A train car is engulfed in a massive explosion, with flames and smoke billowing into the sky as debris flies in all directions, cinematic photograph, explosive action, high contrast, dynamic lighting.",
"style_reference_weight": 0.85
}
}' \
https://api.replicate.com/v1/models/luma/photon-flash/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "356ctt877drgc0ckjzgazxegtw",
"model": "luma/photon-flash",
"version": "hidden",
"input": {
"aspect_ratio": "16:9",
"image_reference_weight": 0.85,
"prompt": "A train car is engulfed in a massive explosion, with flames and smoke billowing into the sky as debris flies in all directions, cinematic photograph, explosive action, high contrast, dynamic lighting.",
"style_reference_weight": 0.85
},
"logs": "Using seed: 16612\nRunning prediction... \nGenerating...\nGenerated image in 6.6sec\nDownloading 1281581 bytes\nDownloaded 1.22MB in 0.33sec",
"output": "https://replicate.delivery/czjl/6iZ89qakg74mCVjFYeDk0GljoYQReoV0k7WwSjxXmCLcV53TA/tmpyf9dx02r.jpg",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-12-05T17:31:01.819Z",
"started_at": "2024-12-05T17:31:01.828427Z",
"completed_at": "2024-12-05T17:31:08.851099Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/356ctt877drgc0ckjzgazxegtw/cancel",
"get": "https://api.replicate.com/v1/predictions/356ctt877drgc0ckjzgazxegtw",
"stream": "https://stream.replicate.com/v1/files/fddq-meqo6r3jznulzojhwpk2axmslpkdq23dkhaf2vombsbpcwvhhova",
"web": "https://replicate.com/p/356ctt877drgc0ckjzgazxegtw"
},
"metrics": {
"image_count": 1,
"predict_time": 7.02267228,
"total_time": 7.032099
}
}