Skip to content

Commit 57a5d61

Browse files
authored
Merge pull request #129 from replicate/switch-from-sdxl-to-flux
Switch from SDXL to Flux (and update deps)
2 parents e840c5c + 0bce401 commit 57a5d61

File tree

7 files changed

+3984
-8304
lines changed

7 files changed

+3984
-8304
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ yarn-error.log*
3030

3131
# vercel
3232
.vercel
33+
34+
yarn.lock

app/api/predictions/[id]/route.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ replicate.fetch = (url, options) => {
1111
return fetch(url, { cache: "no-store", ...options });
1212
};
1313

14-
export async function GET(request, {params}) {
15-
const { id } = params;
14+
export async function GET(request, context) {
15+
const { id } = await context.params;
1616
const prediction = await replicate.predictions.get(id);
1717

1818
if (prediction?.error) {

app/api/predictions/route.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export async function POST(request) {
2727
const { prompt } = await request.json();
2828

2929
const options = {
30-
version: '8beff3369e81422112d93b89ca01426147de542cd4684c244b673b105188fe5f',
30+
model: 'black-forest-labs/flux-schnell',
3131
input: { prompt }
3232
}
3333

app/page.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default function Home() {
3636
prediction.status !== "succeeded" &&
3737
prediction.status !== "failed"
3838
) {
39-
await sleep(1000);
39+
await sleep(250);
4040
const response = await fetch(`/api/predictions/${prediction.id}`);
4141
prediction = await response.json();
4242
if (response.status !== 200) {
@@ -52,8 +52,8 @@ export default function Home() {
5252
<div className="container max-w-2xl mx-auto p-5">
5353
<h1 className="py-6 text-center font-bold text-2xl">
5454
Dream something with{" "}
55-
<a href="https://replicate.com/stability-ai/sdxl?utm_source=project&utm_project=getting-started">
56-
SDXL
55+
<a href="https://replicate.com/black-forest-labs/flux-schnell?utm_source=project&utm_project=getting-started">
56+
Flux Schnell
5757
</a>
5858
</h1>
5959

0 commit comments

Comments
 (0)