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
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Parson Russell TerrierOP
.
17 Replies
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
French Lop
everything you need is in the docs (nodejs)
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Parson Russell TerrierOP
all the information is there but
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
French Lop
but?
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Parson Russell TerrierOP
I can't do it
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Forest bachac
maybe try joining their discord?
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Parson Russell TerrierOP
![Avatar](https://cdn.discordapp.com/avatars/348058974853267458/4dc45539daa8bfaf9d587ed3f32389f6.webp?size=256)
Roberto Duran
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
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Parson Russell TerrierOP
can you write me the next js page using the form on the page
![Avatar](https://cdn.discordapp.com/avatars/348058974853267458/4dc45539daa8bfaf9d587ed3f32389f6.webp?size=256)
Roberto Duran
ok let me find time for it
![Avatar](https://cdn.discordapp.com/avatars/348058974853267458/4dc45539daa8bfaf9d587ed3f32389f6.webp?size=256)
Roberto Duran
@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
![Image](https://cdn.discordapp.com/attachments/1156126109029642252/1156280501770920037/image.png?ex=651465a2&is=65131422&hm=fe6a7598ad395e6da01052471c9d29e293d0d70a4e448d64299bb972b241f474&)
@Parson Russell Terrier remember you need to create the .env file using the .env.example as base and add your replicate api key
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Parson Russell TerrierOP
uuuu thank you bro
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Parson Russell TerrierOP
Where did you get these prompts?
![Avatar](https://cdn.discordapp.com/avatars/348058974853267458/4dc45539daa8bfaf9d587ed3f32389f6.webp?size=256)
Roberto Duran
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
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Parson Russell TerrierOP
Dude, I want to start a startup with you
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Parson Russell TerrierOP
Dude, can you add file input to this?