https://gooey.ai/product-photo-background-generator/api/ how can I run this in next js?
Unanswered
Parson Russell Terrier posted this in #help-forum
Parson Russell TerrierOP
.
17 Replies
French Lop
everything you need is in the docs (nodejs)
Parson Russell TerrierOP
all the information is there but
French Lop
but?
Parson Russell TerrierOP
I can't do it
Forest bachac
maybe try joining their discord?
Parson Russell TerrierOP
you can make a fetch to the replicate endpoint
for example:
for example:
const replicateResponse = await fetch("https://api.replicate.com/v1/predictions", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Token " + process.env.REPLICATE_API_KEY,
},
body: JSON.stringify({
version:
"b1c17d148455c1fda435ababe9ab1e03bc0d917cc3cf4251916f22c45c83c7df",
input: {
image_path: [YOUR_IMAGE_PATH_OR]
},
}),
});
const jsonResponse = await replicateResponse.json();
const endpointUrl = jsonResponse.urls.get;
just remember to run this in a server component, so you dont leak you replicate api token
Parson Russell TerrierOP
can you write me the next js page using the form on the page
ok let me find time for it
@Parson Russell Terrier ok here is a working example https://github.com/roberto-duran/demo-replicate
and a example of the result
and a example of the result
@Parson Russell Terrier remember you need to create the .env file using the .env.example as base and add your replicate api key
Parson Russell TerrierOP
uuuu thank you bro
Parson Russell TerrierOP
Where did you get these prompts?
in the replicate page is a demo tab and at the end of that tab are the examples
i use one of those
i use one of those
Parson Russell TerrierOP
Dude, I want to start a startup with you
Parson Russell TerrierOP
Dude, can you add file input to this?