Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ yarn-error.log*

# vercel
.vercel

yarn.lock
4 changes: 2 additions & 2 deletions app/api/predictions/[id]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ replicate.fetch = (url, options) => {
return fetch(url, { cache: "no-store", ...options });
};

export async function GET(request, {params}) {
const { id } = params;
export async function GET(request, context) {
const { id } = await context.params;
const prediction = await replicate.predictions.get(id);

if (prediction?.error) {
Expand Down
2 changes: 1 addition & 1 deletion app/api/predictions/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function POST(request) {
const { prompt } = await request.json();

const options = {
version: '8beff3369e81422112d93b89ca01426147de542cd4684c244b673b105188fe5f',
model: 'black-forest-labs/flux-schnell',
input: { prompt }
}

Expand Down
6 changes: 3 additions & 3 deletions app/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function Home() {
prediction.status !== "succeeded" &&
prediction.status !== "failed"
) {
await sleep(1000);
await sleep(250);
const response = await fetch(`/api/predictions/${prediction.id}`);
prediction = await response.json();
if (response.status !== 200) {
Expand All @@ -52,8 +52,8 @@ export default function Home() {
<div className="container max-w-2xl mx-auto p-5">
<h1 className="py-6 text-center font-bold text-2xl">
Dream something with{" "}
<a href="https://replicate.com/stability-ai/sdxl?utm_source=project&utm_project=getting-started">
SDXL
<a href="https://replicate.com/black-forest-labs/flux-schnell?utm_source=project&utm_project=getting-started">
Flux Schnell
</a>
</h1>

Expand Down
Loading