Spaces:
Runtime error
Runtime error
Esteves Enzo
commited on
Commit
·
4f2c36e
1
Parent(s):
6b92c38
install prisma to save blob
Browse files- .env +7 -0
- .gitignore +1 -0
- .next/cache/webpack/client-development/0.pack.gz +2 -2
- .next/cache/webpack/client-development/1.pack.gz +2 -2
- .next/cache/webpack/client-development/10.pack.gz +2 -2
- .next/cache/webpack/client-development/11.pack.gz +2 -2
- .next/cache/webpack/client-development/12.pack.gz +2 -2
- .next/cache/webpack/client-development/2.pack.gz +2 -2
- .next/cache/webpack/client-development/3.pack.gz +2 -2
- .next/cache/webpack/client-development/4.pack.gz +2 -2
- .next/cache/webpack/client-development/5.pack.gz +2 -2
- .next/cache/webpack/client-development/6.pack.gz +2 -2
- .next/cache/webpack/client-development/7.pack.gz +2 -2
- .next/cache/webpack/client-development/8.pack.gz +2 -2
- .next/cache/webpack/client-development/9.pack.gz +2 -2
- .next/cache/webpack/client-development/index.pack.gz +2 -2
- .next/cache/webpack/client-development/index.pack.gz.old +0 -0
- .next/cache/webpack/server-development/0.pack.gz +2 -2
- .next/cache/webpack/server-development/1.pack.gz +2 -2
- .next/cache/webpack/server-development/10.pack.gz +2 -2
- .next/cache/webpack/server-development/11.pack.gz +2 -2
- .next/cache/webpack/server-development/12.pack.gz +2 -2
- .next/cache/webpack/server-development/14.pack.gz +2 -2
- .next/cache/webpack/server-development/2.pack.gz +2 -2
- .next/cache/webpack/server-development/3.pack.gz +2 -2
- .next/cache/webpack/server-development/4.pack.gz +2 -2
- .next/cache/webpack/server-development/5.pack.gz +2 -2
- .next/cache/webpack/server-development/6.pack.gz +2 -2
- .next/cache/webpack/server-development/7.pack.gz +2 -2
- .next/cache/webpack/server-development/8.pack.gz +2 -2
- .next/cache/webpack/server-development/9.pack.gz +2 -2
- .next/cache/webpack/server-development/index.pack.gz +2 -2
- .next/cache/webpack/server-development/index.pack.gz.old +0 -0
- .next/server/app-paths-manifest.json +1 -2
- .next/trace +0 -0
- app/api/collections/route.ts +9 -0
- app/api/route.ts +16 -4
- components/header.tsx +2 -2
- components/main/collections/collection.tsx +53 -0
- components/main/collections/index.tsx +42 -0
- components/main/hooks/useCollections.ts +28 -0
- components/main/hooks/useInputGeneration.ts +4 -3
- components/main/index.tsx +5 -47
- package-lock.json +206 -9
- package.json +6 -2
- prisma/schema.prisma +14 -0
.env
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Environment variables declared in this file are automatically made available to Prisma.
|
2 |
+
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
|
3 |
+
|
4 |
+
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
|
5 |
+
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
|
6 |
+
|
7 |
+
DATABASE_URL="file:./dev.db"
|
.gitignore
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
/node_modules
|
5 |
/.pnp
|
6 |
.pnp.js
|
|
|
7 |
|
8 |
# testing
|
9 |
/coverage
|
|
|
4 |
/node_modules
|
5 |
/.pnp
|
6 |
.pnp.js
|
7 |
+
/data/*
|
8 |
|
9 |
# testing
|
10 |
/coverage
|
.next/cache/webpack/client-development/0.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b61cd9c662ea4604ac7974f7ad0210f21b6ceb2e1442458c432a8f0549771412
|
3 |
+
size 68573
|
.next/cache/webpack/client-development/1.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:79adbab21e70193f275d14dba745db5039d09efe4746e358e20a71220b1cc8d4
|
3 |
+
size 1750
|
.next/cache/webpack/client-development/10.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2c0326d66ccd4c8027bd50755f48740a7d2fd318cc22d71d637e80800ee3d2b2
|
3 |
+
size 24064
|
.next/cache/webpack/client-development/11.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3117969c4894077eedbc9a3b8c2a993a38050eabba3b0036a6a902d2b5600ac4
|
3 |
+
size 11328079
|
.next/cache/webpack/client-development/12.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c11d8bc715a54d8850d316d243ac120976e233ec542b9433c788c70ac545d191
|
3 |
+
size 3628984
|
.next/cache/webpack/client-development/2.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:518d31c7cf21c9294161e0349976002cfb55cc172442a803deb5751b8f418a5b
|
3 |
+
size 428
|
.next/cache/webpack/client-development/3.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c587ee53704e34c183e65b0a312ce5cbd82025e7eb5c70b46bdf44993f34bec9
|
3 |
+
size 9002
|
.next/cache/webpack/client-development/4.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1ba3e7b24bab0d3a7b93dd87e145e209adb33f34351c5b5bcb84330e6a8d117d
|
3 |
+
size 30624
|
.next/cache/webpack/client-development/5.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:907fd184466e030ca19f97c04a1dbf62cdb6838079a830a2e6bf4a44fc70a41c
|
3 |
+
size 3631300
|
.next/cache/webpack/client-development/6.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:98d25f4d4962d61f849ed435252bdbc5629aa5ec361faf0de6e3ba45076cf62d
|
3 |
+
size 6101
|
.next/cache/webpack/client-development/7.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0f4320ccf6ff4954eb14e8df7bd36c98e9a94d07301e66a5f9162b2ffe8b95d4
|
3 |
+
size 30277
|
.next/cache/webpack/client-development/8.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f24b6eeeb4851031f52308fbff253290298c03bec71081054090e4e62ab9b359
|
3 |
+
size 6517
|
.next/cache/webpack/client-development/9.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d592538bb09693dea60f23fb614bef475c0070109faba3cebd8e2100a758cb01
|
3 |
+
size 1675
|
.next/cache/webpack/client-development/index.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e3d23577ffebf3b2e5dda8400694091a8971d26b0cb26919faea0f439f34fc4a
|
3 |
+
size 183092
|
.next/cache/webpack/client-development/index.pack.gz.old
CHANGED
Binary files a/.next/cache/webpack/client-development/index.pack.gz.old and b/.next/cache/webpack/client-development/index.pack.gz.old differ
|
|
.next/cache/webpack/server-development/0.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9ebed8c2ed3fcbc599dfe09a1a0525a40de0565638106d288479ce40497d64ff
|
3 |
+
size 53903
|
.next/cache/webpack/server-development/1.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b31f9280c64d1dcc3450a1d9da47f4ca1c31d5c2d42ba0321501946796117f14
|
3 |
+
size 11813
|
.next/cache/webpack/server-development/10.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:006cff238e51671646876f8ef15ebf038ab46ce48ede869fab91d756e725bda0
|
3 |
+
size 30796
|
.next/cache/webpack/server-development/11.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f83f382236143607ab70209ebefb5fcd8ac482aedd94025ee0b851cedb3e1d28
|
3 |
+
size 5509581
|
.next/cache/webpack/server-development/12.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8d145a687c93e2719b2af7729e1a35b23458dd8ef33caecd9d4c438089b88b89
|
3 |
+
size 2864544
|
.next/cache/webpack/server-development/14.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:31e0b77cb81f15d82794218e571623bc27089be5c8fd6ea1e3005f8dc7616f1f
|
3 |
+
size 3373
|
.next/cache/webpack/server-development/2.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:44e0a75b02ca3e7d17404ce3e60bcc9ecdaf2020ed951fa7ed4f90038f8250cb
|
3 |
+
size 397
|
.next/cache/webpack/server-development/3.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eb3b474c87838860f18d92fc1f83b38cd96b1ee91ea28144ab58a453d521b834
|
3 |
+
size 2809144
|
.next/cache/webpack/server-development/4.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:87a80a0307d74997f8fcb4e59aa09983685159bebbae8f077992f91df7dcf851
|
3 |
+
size 6811
|
.next/cache/webpack/server-development/5.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:99bc47786fa9f09829dfcffe2d1856bb8e7e37f2d48e7b9f04a540e3c4a28a43
|
3 |
+
size 69464
|
.next/cache/webpack/server-development/6.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2c980034fde9d010ea8a0f879f60bc9e896498546f0d1b87162f1cfbb9bea304
|
3 |
+
size 3932
|
.next/cache/webpack/server-development/7.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f7de6f6e7160c45cb55ebb9691bf85f1f40207bfd8a0867c6bd5530e92f30b10
|
3 |
+
size 5509483
|
.next/cache/webpack/server-development/8.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a146ee1d12953dff43fcc85a8bd5306b2779a08497f768005387818ba5e6ff18
|
3 |
+
size 4142
|
.next/cache/webpack/server-development/9.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:804dfbbe6417488ec23c46baf19e47e9216343a38fc9151946d7db77985194b1
|
3 |
+
size 4509
|
.next/cache/webpack/server-development/index.pack.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2263fcf7868a2341d7d2f8dff213ec62b0671d3cd72c3bc060fe3bed51e9ab22
|
3 |
+
size 121096
|
.next/cache/webpack/server-development/index.pack.gz.old
CHANGED
Binary files a/.next/cache/webpack/server-development/index.pack.gz.old and b/.next/cache/webpack/server-development/index.pack.gz.old differ
|
|
.next/server/app-paths-manifest.json
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
{
|
2 |
-
"/page": "app/page.js"
|
3 |
-
"/api/route": "app/api/route.js"
|
4 |
}
|
|
|
1 |
{
|
2 |
+
"/page": "app/page.js"
|
|
|
3 |
}
|
.next/trace
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
app/api/collections/route.ts
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { PrismaClient } from '@prisma/client'
|
2 |
+
|
3 |
+
const prisma = new PrismaClient()
|
4 |
+
|
5 |
+
export async function GET() {
|
6 |
+
const images = await prisma.image.findMany()
|
7 |
+
|
8 |
+
return Response.json({ images, status: 200, statusText: "OK" })
|
9 |
+
}
|
app/api/route.ts
CHANGED
@@ -1,4 +1,7 @@
|
|
1 |
import { NextResponse } from "next/server";
|
|
|
|
|
|
|
2 |
|
3 |
export async function POST(
|
4 |
request: Request,
|
@@ -9,6 +12,7 @@ export async function POST(
|
|
9 |
method: 'POST',
|
10 |
body: JSON.stringify({
|
11 |
inputs,
|
|
|
12 |
}),
|
13 |
headers: {
|
14 |
Authorization: `Bearer ${process.env.NEXT_APP_HF_TOKEN}`,
|
@@ -18,9 +22,17 @@ export async function POST(
|
|
18 |
|
19 |
const blob = await response.blob()
|
20 |
const headers = new Headers();
|
21 |
-
|
22 |
headers.set("Content-Type", "image/*");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
}
|
|
|
1 |
import { NextResponse } from "next/server";
|
2 |
+
import { PrismaClient } from '@prisma/client'
|
3 |
+
|
4 |
+
const prisma = new PrismaClient()
|
5 |
|
6 |
export async function POST(
|
7 |
request: Request,
|
|
|
12 |
method: 'POST',
|
13 |
body: JSON.stringify({
|
14 |
inputs,
|
15 |
+
stream: true,
|
16 |
}),
|
17 |
headers: {
|
18 |
Authorization: `Bearer ${process.env.NEXT_APP_HF_TOKEN}`,
|
|
|
22 |
|
23 |
const blob = await response.blob()
|
24 |
const headers = new Headers();
|
|
|
25 |
headers.set("Content-Type", "image/*");
|
26 |
+
|
27 |
+
const arrayBuffer = await blob.arrayBuffer()
|
28 |
+
const bytes = Buffer.from(arrayBuffer)
|
29 |
+
|
30 |
+
const new_blob = await prisma.image.create({
|
31 |
+
data: {
|
32 |
+
prompt: inputs,
|
33 |
+
blob: bytes,
|
34 |
+
},
|
35 |
+
})
|
36 |
|
37 |
+
return Response.json({ blob: new_blob, status: 200, statusText: "OK", headers });
|
38 |
+
}
|
|
components/header.tsx
CHANGED
@@ -17,7 +17,7 @@ export const Header = () => {
|
|
17 |
Fast Stable Diffusion XL <br />
|
18 |
on TPU v5e ⚡
|
19 |
</h1>
|
20 |
-
<p className="text-sm text-white mt-3">
|
21 |
Powered by{" "}
|
22 |
<a
|
23 |
href="https://huggingface.co"
|
@@ -30,7 +30,7 @@ export const Header = () => {
|
|
30 |
<Image
|
31 |
src={HeaderImage}
|
32 |
alt="Hugging Face header"
|
33 |
-
className="absolute w-full -right-10 bottom-0 max-w-4xl z-[-1]"
|
34 |
/>
|
35 |
</div>
|
36 |
<div className="absolute bottom-0 w-full h-full left-0 bg-gradient-to-b from-transparent to-black z-[1]" />
|
|
|
17 |
Fast Stable Diffusion XL <br />
|
18 |
on TPU v5e ⚡
|
19 |
</h1>
|
20 |
+
<p className="text-sm text-white mt-3 text-center lg:text-left">
|
21 |
Powered by{" "}
|
22 |
<a
|
23 |
href="https://huggingface.co"
|
|
|
30 |
<Image
|
31 |
src={HeaderImage}
|
32 |
alt="Hugging Face header"
|
33 |
+
className="absolute w-full -right-10 bottom-0 max-w-lg lg:max-w-4xl z-[-1]"
|
34 |
/>
|
35 |
</div>
|
36 |
<div className="absolute bottom-0 w-full h-full left-0 bg-gradient-to-b from-transparent to-black z-[1]" />
|
components/main/collections/collection.tsx
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { motion } from "framer-motion";
|
2 |
+
import { useMemo } from "react";
|
3 |
+
|
4 |
+
interface Props {
|
5 |
+
collection: {
|
6 |
+
prompt: string;
|
7 |
+
blob: {
|
8 |
+
data: ArrayBuffer;
|
9 |
+
type: string;
|
10 |
+
};
|
11 |
+
id: number;
|
12 |
+
};
|
13 |
+
}
|
14 |
+
|
15 |
+
export const Collection: React.FC<Props> = ({ collection }) => {
|
16 |
+
const arrayBufferToBase64 = (buffer: ArrayBuffer) => {
|
17 |
+
let binary = "";
|
18 |
+
const bytes = [].slice.call(new Uint8Array(buffer));
|
19 |
+
bytes.forEach((b: any) => (binary += String.fromCharCode(b)));
|
20 |
+
return window.btoa(binary);
|
21 |
+
};
|
22 |
+
|
23 |
+
const bufferToBase64 = useMemo(() => {
|
24 |
+
const base64Flag = "data:image/jpeg;base64,";
|
25 |
+
const imageStr = arrayBufferToBase64(collection.blob.data);
|
26 |
+
return base64Flag + imageStr;
|
27 |
+
}, [collection]);
|
28 |
+
|
29 |
+
return (
|
30 |
+
<motion.div
|
31 |
+
initial={{ y: 100, opacity: 0 }}
|
32 |
+
animate={{ y: 0, opacity: 1 }}
|
33 |
+
transition={{ duration: 0.35, delay: collection.id * 0.1 }}
|
34 |
+
className="rounded-3xl h-[377px] bg-cover cursor-pointer z-[1] group overflow-hidden p-3 relative flex items-end group"
|
35 |
+
>
|
36 |
+
<div className="bg-[#292424] bg-opacity-60 rounded-xl p-3 border-white/20 border w-full translate-y-full opacity-0 transition-all duration-200 group-hover:translate-y-0 group-hover:opacity-100">
|
37 |
+
<p className="text-xs font-semibold text-white/60 mb-0.5">27 October</p>
|
38 |
+
<p className="text-lg font-medium text-white lowercase leading-snug">
|
39 |
+
{collection.prompt}
|
40 |
+
</p>
|
41 |
+
<p className="text-white text-sm text-right font-semibold mt-2">
|
42 |
+
Try it now
|
43 |
+
</p>
|
44 |
+
</div>
|
45 |
+
<div
|
46 |
+
style={{
|
47 |
+
backgroundImage: `url(${bufferToBase64})`,
|
48 |
+
}}
|
49 |
+
className="rounded-3xl bg-red-400 bg-cover absolute top-0 left-0 w-full h-full z-[-1] transition-all duration-200 group-hover:scale-125 bg-center"
|
50 |
+
/>
|
51 |
+
</motion.div>
|
52 |
+
);
|
53 |
+
};
|
components/main/collections/index.tsx
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import classNames from "classnames";
|
2 |
+
import { motion } from "framer-motion";
|
3 |
+
|
4 |
+
import { useCollections } from "../hooks/useCollections";
|
5 |
+
import { Collection } from "./collection";
|
6 |
+
|
7 |
+
const IMAGES = [
|
8 |
+
"https://www.blueshadow.art/wp-content/uploads/2023/03/prompt13.jpg",
|
9 |
+
"https://www.blueshadow.art/wp-content/uploads/2022/09/prompt01.jpg",
|
10 |
+
"https://www.blueshadow.art/wp-content/uploads/2022/09/prompt02.jpg",
|
11 |
+
"https://www.blueshadow.art/wp-content/uploads/2022/09/prompt06.jpg",
|
12 |
+
"https://www.blueshadow.art/wp-content/uploads/2023/03/prompt14.jpg",
|
13 |
+
"https://www.blueshadow.art/wp-content/uploads/2023/03/prompt17.jpg",
|
14 |
+
"https://www.blueshadow.art/wp-content/uploads/2023/03/prompt18.jpg",
|
15 |
+
"https://www.blueshadow.art/wp-content/uploads/2022/10/prompt27.jpg",
|
16 |
+
"https://www.blueshadow.art/wp-content/uploads/2022/10/prompt32.jpg",
|
17 |
+
"https://www.blueshadow.art/wp-content/uploads/2022/10/prompt34.jpg",
|
18 |
+
"https://www.blueshadow.art/wp-content/uploads/2023/01/prompt44.jpg",
|
19 |
+
];
|
20 |
+
|
21 |
+
export const Collections = () => {
|
22 |
+
const { collections, loading } = useCollections();
|
23 |
+
|
24 |
+
if (loading) return;
|
25 |
+
|
26 |
+
return (
|
27 |
+
<div className="px-6 max-w-[1722px] mx-auto grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-5 mt-8 lg:mt-14">
|
28 |
+
{collections.map((col, e) => (
|
29 |
+
<div
|
30 |
+
key={e}
|
31 |
+
className={classNames("w-full grid-cols-1 grid gap-5", {
|
32 |
+
"translate-y-12": e % 2,
|
33 |
+
})}
|
34 |
+
>
|
35 |
+
{col.map((collection, i) => (
|
36 |
+
<Collection key={i} collection={collection} />
|
37 |
+
))}
|
38 |
+
</div>
|
39 |
+
))}
|
40 |
+
</div>
|
41 |
+
);
|
42 |
+
};
|
components/main/hooks/useCollections.ts
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { useState } from "react";
|
2 |
+
import { useMount } from "react-use";
|
3 |
+
|
4 |
+
export const useCollections = () => {
|
5 |
+
const [collections, setCollections] = useState([[], [], [], [], []])
|
6 |
+
const [loading, setLoading] = useState<boolean>(false)
|
7 |
+
|
8 |
+
useMount(() => {
|
9 |
+
setLoading(true)
|
10 |
+
fetch("/api/collections", { method: "GET" })
|
11 |
+
.then(async (res) => res.json())
|
12 |
+
.then((data) => {
|
13 |
+
const chunked = data.images.reduce((acc: any, _: any, i:number) => {
|
14 |
+
acc[i % 5].push(data.images[i])
|
15 |
+
return acc
|
16 |
+
}, [[], [], [], [], []])
|
17 |
+
setCollections(chunked)
|
18 |
+
})
|
19 |
+
.finally(() => {
|
20 |
+
setLoading(false)
|
21 |
+
})
|
22 |
+
})
|
23 |
+
|
24 |
+
return {
|
25 |
+
collections,
|
26 |
+
loading,
|
27 |
+
}
|
28 |
+
};
|
components/main/hooks/useInputGeneration.ts
CHANGED
@@ -16,8 +16,9 @@ export const useInputGeneration = () => {
|
|
16 |
})
|
17 |
}
|
18 |
)
|
19 |
-
.then(res =>
|
20 |
-
|
|
|
21 |
resolve(true)
|
22 |
})
|
23 |
.finally(() => {
|
@@ -34,4 +35,4 @@ export const useInputGeneration = () => {
|
|
34 |
submit,
|
35 |
}
|
36 |
|
37 |
-
}
|
|
|
16 |
})
|
17 |
}
|
18 |
)
|
19 |
+
.then(async res => res.json())
|
20 |
+
.then(data => {
|
21 |
+
console.log(data)
|
22 |
resolve(true)
|
23 |
})
|
24 |
.finally(() => {
|
|
|
35 |
submit,
|
36 |
}
|
37 |
|
38 |
+
}
|
components/main/index.tsx
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
"use client";
|
2 |
|
3 |
import { useState } from "react";
|
4 |
-
import classNames from "classnames";
|
5 |
-
import { motion } from "framer-motion";
|
6 |
import { HiUserGroup, HiHeart } from "react-icons/hi2";
|
7 |
|
8 |
import { InputGeneration } from "@/components/input-generation";
|
9 |
import { Button } from "@/components/button";
|
|
|
10 |
import { useInputGeneration } from "./hooks/useInputGeneration";
|
|
|
11 |
|
12 |
const categories = [
|
13 |
{
|
@@ -22,20 +22,6 @@ const categories = [
|
|
22 |
},
|
23 |
];
|
24 |
|
25 |
-
const IMAGES = [
|
26 |
-
"https://www.blueshadow.art/wp-content/uploads/2023/03/prompt13.jpg",
|
27 |
-
"https://www.blueshadow.art/wp-content/uploads/2022/09/prompt01.jpg",
|
28 |
-
"https://www.blueshadow.art/wp-content/uploads/2022/09/prompt02.jpg",
|
29 |
-
"https://www.blueshadow.art/wp-content/uploads/2022/09/prompt06.jpg",
|
30 |
-
"https://www.blueshadow.art/wp-content/uploads/2023/03/prompt14.jpg",
|
31 |
-
"https://www.blueshadow.art/wp-content/uploads/2023/03/prompt17.jpg",
|
32 |
-
"https://www.blueshadow.art/wp-content/uploads/2023/03/prompt18.jpg",
|
33 |
-
"https://www.blueshadow.art/wp-content/uploads/2022/10/prompt27.jpg",
|
34 |
-
"https://www.blueshadow.art/wp-content/uploads/2022/10/prompt32.jpg",
|
35 |
-
"https://www.blueshadow.art/wp-content/uploads/2022/10/prompt34.jpg",
|
36 |
-
"https://www.blueshadow.art/wp-content/uploads/2023/01/prompt44.jpg",
|
37 |
-
];
|
38 |
-
|
39 |
export const Main = () => {
|
40 |
const { prompt, setPrompt, submit, loading } = useInputGeneration();
|
41 |
const [category, setCategory] = useState<string>("community");
|
@@ -43,14 +29,14 @@ export const Main = () => {
|
|
43 |
return (
|
44 |
<main className="pt-6 z-[2] relative">
|
45 |
<div className="px-6 mx-auto max-w-7xl">
|
46 |
-
<div className="flex items-center justify-between w-full -translate-y-1/2">
|
47 |
<InputGeneration
|
48 |
prompt={prompt}
|
49 |
onChange={setPrompt}
|
50 |
onSubmit={submit}
|
51 |
loading={loading}
|
52 |
/>
|
53 |
-
<div className="flex items-center justify-end gap-5 w-full">
|
54 |
{categories.map(({ key, label, icon }) => (
|
55 |
<Button
|
56 |
key={key}
|
@@ -64,35 +50,7 @@ export const Main = () => {
|
|
64 |
</div>
|
65 |
</div>
|
66 |
</div>
|
67 |
-
<
|
68 |
-
{Array.from({ length: 5 }).map((_, e) => (
|
69 |
-
<div
|
70 |
-
key={e}
|
71 |
-
className={classNames("w-full grid-cols-1 grid gap-5", {
|
72 |
-
"translate-y-12": e % 2,
|
73 |
-
})}
|
74 |
-
>
|
75 |
-
{Array.from({ length: 6 }).map((_, i) => (
|
76 |
-
<motion.div
|
77 |
-
key={i}
|
78 |
-
initial={{ y: 100, opacity: 0 }}
|
79 |
-
animate={{ y: 0, opacity: 1 }}
|
80 |
-
transition={{ duration: 0.35, delay: i * 0.1 }}
|
81 |
-
className="rounded-3xl h-[377px] bg-cover cursor-pointer relative z-[1] group overflow-hidden"
|
82 |
-
>
|
83 |
-
<div
|
84 |
-
style={{
|
85 |
-
backgroundImage: `url(${
|
86 |
-
IMAGES[Math.floor(Math.random() * IMAGES.length)]
|
87 |
-
})`,
|
88 |
-
}}
|
89 |
-
className="rounded-3xl bg-cover absolute top-0 left-0 w-full h-full z-[-1] transition-all duration-200 group-hover:scale-125"
|
90 |
-
/>
|
91 |
-
</motion.div>
|
92 |
-
))}
|
93 |
-
</div>
|
94 |
-
))}
|
95 |
-
</div>
|
96 |
</main>
|
97 |
);
|
98 |
};
|
|
|
1 |
"use client";
|
2 |
|
3 |
import { useState } from "react";
|
|
|
|
|
4 |
import { HiUserGroup, HiHeart } from "react-icons/hi2";
|
5 |
|
6 |
import { InputGeneration } from "@/components/input-generation";
|
7 |
import { Button } from "@/components/button";
|
8 |
+
|
9 |
import { useInputGeneration } from "./hooks/useInputGeneration";
|
10 |
+
import { Collections } from "./collections";
|
11 |
|
12 |
const categories = [
|
13 |
{
|
|
|
22 |
},
|
23 |
];
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
export const Main = () => {
|
26 |
const { prompt, setPrompt, submit, loading } = useInputGeneration();
|
27 |
const [category, setCategory] = useState<string>("community");
|
|
|
29 |
return (
|
30 |
<main className="pt-6 z-[2] relative">
|
31 |
<div className="px-6 mx-auto max-w-7xl">
|
32 |
+
<div className="flex flex-col lg:flex-row items-center justify-between w-full -translate-y-1/2">
|
33 |
<InputGeneration
|
34 |
prompt={prompt}
|
35 |
onChange={setPrompt}
|
36 |
onSubmit={submit}
|
37 |
loading={loading}
|
38 |
/>
|
39 |
+
<div className="flex items-center justify-center lg:justify-end gap-5 w-full mt-6 lg:mt-0">
|
40 |
{categories.map(({ key, label, icon }) => (
|
41 |
<Button
|
42 |
key={key}
|
|
|
50 |
</div>
|
51 |
</div>
|
52 |
</div>
|
53 |
+
<Collections />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
</main>
|
55 |
);
|
56 |
};
|
package-lock.json
CHANGED
@@ -8,7 +8,9 @@
|
|
8 |
"name": "hf-fast-image-generation",
|
9 |
"version": "0.1.0",
|
10 |
"dependencies": {
|
|
|
11 |
"classnames": "^2.3.2",
|
|
|
12 |
"framer-motion": "^10.16.4",
|
13 |
"next": "13.5.6",
|
14 |
"react": "^18",
|
@@ -17,15 +19,17 @@
|
|
17 |
"react-use": "^17.4.0"
|
18 |
},
|
19 |
"devDependencies": {
|
20 |
-
"@types/node": "^20",
|
21 |
"@types/react": "^18",
|
22 |
"@types/react-dom": "^18",
|
23 |
"autoprefixer": "^10",
|
24 |
"eslint": "^8",
|
25 |
"eslint-config-next": "13.5.6",
|
26 |
"postcss": "^8",
|
|
|
27 |
"tailwindcss": "^3",
|
28 |
-
"
|
|
|
29 |
}
|
30 |
},
|
31 |
"node_modules/@aashutoshrathi/word-wrap": {
|
@@ -60,6 +64,28 @@
|
|
60 |
"node": ">=6.9.0"
|
61 |
}
|
62 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
"node_modules/@emotion/is-prop-valid": {
|
64 |
"version": "0.8.8",
|
65 |
"resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz",
|
@@ -396,6 +422,38 @@
|
|
396 |
"node": ">= 8"
|
397 |
}
|
398 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
"node_modules/@rushstack/eslint-patch": {
|
400 |
"version": "1.5.1",
|
401 |
"resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.5.1.tgz",
|
@@ -410,6 +468,30 @@
|
|
410 |
"tslib": "^2.4.0"
|
411 |
}
|
412 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
"node_modules/@types/js-cookie": {
|
414 |
"version": "2.2.7",
|
415 |
"resolved": "https://registry.npmjs.org/@types/js-cookie/-/js-cookie-2.2.7.tgz",
|
@@ -422,12 +504,12 @@
|
|
422 |
"dev": true
|
423 |
},
|
424 |
"node_modules/@types/node": {
|
425 |
-
"version": "20.8.
|
426 |
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.
|
427 |
-
"integrity": "sha512-
|
428 |
"dev": true,
|
429 |
"dependencies": {
|
430 |
-
"undici-types": "~5.
|
431 |
}
|
432 |
},
|
433 |
"node_modules/@types/prop-types": {
|
@@ -596,6 +678,15 @@
|
|
596 |
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
597 |
}
|
598 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
599 |
"node_modules/ajv": {
|
600 |
"version": "6.12.6",
|
601 |
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
@@ -1125,6 +1216,12 @@
|
|
1125 |
"toggle-selection": "^1.0.6"
|
1126 |
}
|
1127 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
1128 |
"node_modules/cross-spawn": {
|
1129 |
"version": "7.0.3",
|
1130 |
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
@@ -1251,6 +1348,15 @@
|
|
1251 |
"integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==",
|
1252 |
"dev": true
|
1253 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1254 |
"node_modules/dir-glob": {
|
1255 |
"version": "3.0.1",
|
1256 |
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
|
@@ -1950,6 +2056,11 @@
|
|
1950 |
"node": "^10.12.0 || >=12.0.0"
|
1951 |
}
|
1952 |
},
|
|
|
|
|
|
|
|
|
|
|
1953 |
"node_modules/fill-range": {
|
1954 |
"version": "7.0.1",
|
1955 |
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
@@ -2943,6 +3054,12 @@
|
|
2943 |
"node": ">=10"
|
2944 |
}
|
2945 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
2946 |
"node_modules/mdn-data": {
|
2947 |
"version": "2.0.14",
|
2948 |
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz",
|
@@ -3530,6 +3647,22 @@
|
|
3530 |
"node": ">= 0.8.0"
|
3531 |
}
|
3532 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3533 |
"node_modules/prop-types": {
|
3534 |
"version": "15.8.1",
|
3535 |
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
|
@@ -4329,6 +4462,55 @@
|
|
4329 |
"integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==",
|
4330 |
"dev": true
|
4331 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4332 |
"node_modules/tsconfig-paths": {
|
4333 |
"version": "3.14.2",
|
4334 |
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz",
|
@@ -4464,9 +4646,9 @@
|
|
4464 |
}
|
4465 |
},
|
4466 |
"node_modules/undici-types": {
|
4467 |
-
"version": "5.
|
4468 |
-
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.
|
4469 |
-
"integrity": "sha512-
|
4470 |
"dev": true
|
4471 |
},
|
4472 |
"node_modules/update-browserslist-db": {
|
@@ -4514,6 +4696,12 @@
|
|
4514 |
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
|
4515 |
"dev": true
|
4516 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
4517 |
"node_modules/watchpack": {
|
4518 |
"version": "2.4.0",
|
4519 |
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
|
@@ -4638,6 +4826,15 @@
|
|
4638 |
"node": ">= 14"
|
4639 |
}
|
4640 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4641 |
"node_modules/yocto-queue": {
|
4642 |
"version": "0.1.0",
|
4643 |
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
|
|
8 |
"name": "hf-fast-image-generation",
|
9 |
"version": "0.1.0",
|
10 |
"dependencies": {
|
11 |
+
"@prisma/client": "^5.5.2",
|
12 |
"classnames": "^2.3.2",
|
13 |
+
"filereader": "^0.10.3",
|
14 |
"framer-motion": "^10.16.4",
|
15 |
"next": "13.5.6",
|
16 |
"react": "^18",
|
|
|
19 |
"react-use": "^17.4.0"
|
20 |
},
|
21 |
"devDependencies": {
|
22 |
+
"@types/node": "^20.8.9",
|
23 |
"@types/react": "^18",
|
24 |
"@types/react-dom": "^18",
|
25 |
"autoprefixer": "^10",
|
26 |
"eslint": "^8",
|
27 |
"eslint-config-next": "13.5.6",
|
28 |
"postcss": "^8",
|
29 |
+
"prisma": "^5.5.2",
|
30 |
"tailwindcss": "^3",
|
31 |
+
"ts-node": "^10.9.1",
|
32 |
+
"typescript": "^5.2.2"
|
33 |
}
|
34 |
},
|
35 |
"node_modules/@aashutoshrathi/word-wrap": {
|
|
|
64 |
"node": ">=6.9.0"
|
65 |
}
|
66 |
},
|
67 |
+
"node_modules/@cspotcode/source-map-support": {
|
68 |
+
"version": "0.8.1",
|
69 |
+
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
70 |
+
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
|
71 |
+
"dev": true,
|
72 |
+
"dependencies": {
|
73 |
+
"@jridgewell/trace-mapping": "0.3.9"
|
74 |
+
},
|
75 |
+
"engines": {
|
76 |
+
"node": ">=12"
|
77 |
+
}
|
78 |
+
},
|
79 |
+
"node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": {
|
80 |
+
"version": "0.3.9",
|
81 |
+
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
|
82 |
+
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
|
83 |
+
"dev": true,
|
84 |
+
"dependencies": {
|
85 |
+
"@jridgewell/resolve-uri": "^3.0.3",
|
86 |
+
"@jridgewell/sourcemap-codec": "^1.4.10"
|
87 |
+
}
|
88 |
+
},
|
89 |
"node_modules/@emotion/is-prop-valid": {
|
90 |
"version": "0.8.8",
|
91 |
"resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz",
|
|
|
422 |
"node": ">= 8"
|
423 |
}
|
424 |
},
|
425 |
+
"node_modules/@prisma/client": {
|
426 |
+
"version": "5.5.2",
|
427 |
+
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.5.2.tgz",
|
428 |
+
"integrity": "sha512-54XkqR8M+fxbzYqe+bIXimYnkkcGqgOh0dn0yWtIk6CQT4IUCAvNFNcQZwk2KqaLU+/1PHTSWrcHtx4XjluR5w==",
|
429 |
+
"hasInstallScript": true,
|
430 |
+
"dependencies": {
|
431 |
+
"@prisma/engines-version": "5.5.1-1.aebc046ce8b88ebbcb45efe31cbe7d06fd6abc0a"
|
432 |
+
},
|
433 |
+
"engines": {
|
434 |
+
"node": ">=16.13"
|
435 |
+
},
|
436 |
+
"peerDependencies": {
|
437 |
+
"prisma": "*"
|
438 |
+
},
|
439 |
+
"peerDependenciesMeta": {
|
440 |
+
"prisma": {
|
441 |
+
"optional": true
|
442 |
+
}
|
443 |
+
}
|
444 |
+
},
|
445 |
+
"node_modules/@prisma/engines": {
|
446 |
+
"version": "5.5.2",
|
447 |
+
"resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.5.2.tgz",
|
448 |
+
"integrity": "sha512-Be5hoNF8k+lkB3uEMiCHbhbfF6aj1GnrTBnn5iYFT7GEr3TsOEp1soviEcBR0tYCgHbxjcIxJMhdbvxALJhAqg==",
|
449 |
+
"devOptional": true,
|
450 |
+
"hasInstallScript": true
|
451 |
+
},
|
452 |
+
"node_modules/@prisma/engines-version": {
|
453 |
+
"version": "5.5.1-1.aebc046ce8b88ebbcb45efe31cbe7d06fd6abc0a",
|
454 |
+
"resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.5.1-1.aebc046ce8b88ebbcb45efe31cbe7d06fd6abc0a.tgz",
|
455 |
+
"integrity": "sha512-O+qHFnZvAyOFk1tUco2/VdiqS0ym42a3+6CYLScllmnpbyiTplgyLt2rK/B9BTjYkSHjrgMhkG47S0oqzdIckA=="
|
456 |
+
},
|
457 |
"node_modules/@rushstack/eslint-patch": {
|
458 |
"version": "1.5.1",
|
459 |
"resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.5.1.tgz",
|
|
|
468 |
"tslib": "^2.4.0"
|
469 |
}
|
470 |
},
|
471 |
+
"node_modules/@tsconfig/node10": {
|
472 |
+
"version": "1.0.9",
|
473 |
+
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
|
474 |
+
"integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
|
475 |
+
"dev": true
|
476 |
+
},
|
477 |
+
"node_modules/@tsconfig/node12": {
|
478 |
+
"version": "1.0.11",
|
479 |
+
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
|
480 |
+
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
|
481 |
+
"dev": true
|
482 |
+
},
|
483 |
+
"node_modules/@tsconfig/node14": {
|
484 |
+
"version": "1.0.3",
|
485 |
+
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
|
486 |
+
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
|
487 |
+
"dev": true
|
488 |
+
},
|
489 |
+
"node_modules/@tsconfig/node16": {
|
490 |
+
"version": "1.0.4",
|
491 |
+
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
|
492 |
+
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
|
493 |
+
"dev": true
|
494 |
+
},
|
495 |
"node_modules/@types/js-cookie": {
|
496 |
"version": "2.2.7",
|
497 |
"resolved": "https://registry.npmjs.org/@types/js-cookie/-/js-cookie-2.2.7.tgz",
|
|
|
504 |
"dev": true
|
505 |
},
|
506 |
"node_modules/@types/node": {
|
507 |
+
"version": "20.8.9",
|
508 |
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz",
|
509 |
+
"integrity": "sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==",
|
510 |
"dev": true,
|
511 |
"dependencies": {
|
512 |
+
"undici-types": "~5.26.4"
|
513 |
}
|
514 |
},
|
515 |
"node_modules/@types/prop-types": {
|
|
|
678 |
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
679 |
}
|
680 |
},
|
681 |
+
"node_modules/acorn-walk": {
|
682 |
+
"version": "8.2.0",
|
683 |
+
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
|
684 |
+
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
|
685 |
+
"dev": true,
|
686 |
+
"engines": {
|
687 |
+
"node": ">=0.4.0"
|
688 |
+
}
|
689 |
+
},
|
690 |
"node_modules/ajv": {
|
691 |
"version": "6.12.6",
|
692 |
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
|
|
1216 |
"toggle-selection": "^1.0.6"
|
1217 |
}
|
1218 |
},
|
1219 |
+
"node_modules/create-require": {
|
1220 |
+
"version": "1.1.1",
|
1221 |
+
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
1222 |
+
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
|
1223 |
+
"dev": true
|
1224 |
+
},
|
1225 |
"node_modules/cross-spawn": {
|
1226 |
"version": "7.0.3",
|
1227 |
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
|
|
1348 |
"integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==",
|
1349 |
"dev": true
|
1350 |
},
|
1351 |
+
"node_modules/diff": {
|
1352 |
+
"version": "4.0.2",
|
1353 |
+
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
1354 |
+
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
|
1355 |
+
"dev": true,
|
1356 |
+
"engines": {
|
1357 |
+
"node": ">=0.3.1"
|
1358 |
+
}
|
1359 |
+
},
|
1360 |
"node_modules/dir-glob": {
|
1361 |
"version": "3.0.1",
|
1362 |
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
|
|
|
2056 |
"node": "^10.12.0 || >=12.0.0"
|
2057 |
}
|
2058 |
},
|
2059 |
+
"node_modules/filereader": {
|
2060 |
+
"version": "0.10.3",
|
2061 |
+
"resolved": "https://registry.npmjs.org/filereader/-/filereader-0.10.3.tgz",
|
2062 |
+
"integrity": "sha512-7F8w6GSXuHLN80ukaVOcHgBaiTRHUZr8GeEhNdqfAECcnBoROg4i8hTl+KqtF4yUPffOJVHEFg4iDJb7xIYFng=="
|
2063 |
+
},
|
2064 |
"node_modules/fill-range": {
|
2065 |
"version": "7.0.1",
|
2066 |
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
|
|
3054 |
"node": ">=10"
|
3055 |
}
|
3056 |
},
|
3057 |
+
"node_modules/make-error": {
|
3058 |
+
"version": "1.3.6",
|
3059 |
+
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
3060 |
+
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
|
3061 |
+
"dev": true
|
3062 |
+
},
|
3063 |
"node_modules/mdn-data": {
|
3064 |
"version": "2.0.14",
|
3065 |
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz",
|
|
|
3647 |
"node": ">= 0.8.0"
|
3648 |
}
|
3649 |
},
|
3650 |
+
"node_modules/prisma": {
|
3651 |
+
"version": "5.5.2",
|
3652 |
+
"resolved": "https://registry.npmjs.org/prisma/-/prisma-5.5.2.tgz",
|
3653 |
+
"integrity": "sha512-WQtG6fevOL053yoPl6dbHV+IWgKo25IRN4/pwAGqcWmg7CrtoCzvbDbN9fXUc7QS2KK0LimHIqLsaCOX/vHl8w==",
|
3654 |
+
"devOptional": true,
|
3655 |
+
"hasInstallScript": true,
|
3656 |
+
"dependencies": {
|
3657 |
+
"@prisma/engines": "5.5.2"
|
3658 |
+
},
|
3659 |
+
"bin": {
|
3660 |
+
"prisma": "build/index.js"
|
3661 |
+
},
|
3662 |
+
"engines": {
|
3663 |
+
"node": ">=16.13"
|
3664 |
+
}
|
3665 |
+
},
|
3666 |
"node_modules/prop-types": {
|
3667 |
"version": "15.8.1",
|
3668 |
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
|
|
|
4462 |
"integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==",
|
4463 |
"dev": true
|
4464 |
},
|
4465 |
+
"node_modules/ts-node": {
|
4466 |
+
"version": "10.9.1",
|
4467 |
+
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
|
4468 |
+
"integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
|
4469 |
+
"dev": true,
|
4470 |
+
"dependencies": {
|
4471 |
+
"@cspotcode/source-map-support": "^0.8.0",
|
4472 |
+
"@tsconfig/node10": "^1.0.7",
|
4473 |
+
"@tsconfig/node12": "^1.0.7",
|
4474 |
+
"@tsconfig/node14": "^1.0.0",
|
4475 |
+
"@tsconfig/node16": "^1.0.2",
|
4476 |
+
"acorn": "^8.4.1",
|
4477 |
+
"acorn-walk": "^8.1.1",
|
4478 |
+
"arg": "^4.1.0",
|
4479 |
+
"create-require": "^1.1.0",
|
4480 |
+
"diff": "^4.0.1",
|
4481 |
+
"make-error": "^1.1.1",
|
4482 |
+
"v8-compile-cache-lib": "^3.0.1",
|
4483 |
+
"yn": "3.1.1"
|
4484 |
+
},
|
4485 |
+
"bin": {
|
4486 |
+
"ts-node": "dist/bin.js",
|
4487 |
+
"ts-node-cwd": "dist/bin-cwd.js",
|
4488 |
+
"ts-node-esm": "dist/bin-esm.js",
|
4489 |
+
"ts-node-script": "dist/bin-script.js",
|
4490 |
+
"ts-node-transpile-only": "dist/bin-transpile.js",
|
4491 |
+
"ts-script": "dist/bin-script-deprecated.js"
|
4492 |
+
},
|
4493 |
+
"peerDependencies": {
|
4494 |
+
"@swc/core": ">=1.2.50",
|
4495 |
+
"@swc/wasm": ">=1.2.50",
|
4496 |
+
"@types/node": "*",
|
4497 |
+
"typescript": ">=2.7"
|
4498 |
+
},
|
4499 |
+
"peerDependenciesMeta": {
|
4500 |
+
"@swc/core": {
|
4501 |
+
"optional": true
|
4502 |
+
},
|
4503 |
+
"@swc/wasm": {
|
4504 |
+
"optional": true
|
4505 |
+
}
|
4506 |
+
}
|
4507 |
+
},
|
4508 |
+
"node_modules/ts-node/node_modules/arg": {
|
4509 |
+
"version": "4.1.3",
|
4510 |
+
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
4511 |
+
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
|
4512 |
+
"dev": true
|
4513 |
+
},
|
4514 |
"node_modules/tsconfig-paths": {
|
4515 |
"version": "3.14.2",
|
4516 |
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz",
|
|
|
4646 |
}
|
4647 |
},
|
4648 |
"node_modules/undici-types": {
|
4649 |
+
"version": "5.26.5",
|
4650 |
+
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
4651 |
+
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
|
4652 |
"dev": true
|
4653 |
},
|
4654 |
"node_modules/update-browserslist-db": {
|
|
|
4696 |
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
|
4697 |
"dev": true
|
4698 |
},
|
4699 |
+
"node_modules/v8-compile-cache-lib": {
|
4700 |
+
"version": "3.0.1",
|
4701 |
+
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
4702 |
+
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
|
4703 |
+
"dev": true
|
4704 |
+
},
|
4705 |
"node_modules/watchpack": {
|
4706 |
"version": "2.4.0",
|
4707 |
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
|
|
|
4826 |
"node": ">= 14"
|
4827 |
}
|
4828 |
},
|
4829 |
+
"node_modules/yn": {
|
4830 |
+
"version": "3.1.1",
|
4831 |
+
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
4832 |
+
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
|
4833 |
+
"dev": true,
|
4834 |
+
"engines": {
|
4835 |
+
"node": ">=6"
|
4836 |
+
}
|
4837 |
+
},
|
4838 |
"node_modules/yocto-queue": {
|
4839 |
"version": "0.1.0",
|
4840 |
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
package.json
CHANGED
@@ -9,7 +9,9 @@
|
|
9 |
"lint": "next lint"
|
10 |
},
|
11 |
"dependencies": {
|
|
|
12 |
"classnames": "^2.3.2",
|
|
|
13 |
"framer-motion": "^10.16.4",
|
14 |
"next": "13.5.6",
|
15 |
"react": "^18",
|
@@ -18,14 +20,16 @@
|
|
18 |
"react-use": "^17.4.0"
|
19 |
},
|
20 |
"devDependencies": {
|
21 |
-
"@types/node": "^20",
|
22 |
"@types/react": "^18",
|
23 |
"@types/react-dom": "^18",
|
24 |
"autoprefixer": "^10",
|
25 |
"eslint": "^8",
|
26 |
"eslint-config-next": "13.5.6",
|
27 |
"postcss": "^8",
|
|
|
28 |
"tailwindcss": "^3",
|
29 |
-
"
|
|
|
30 |
}
|
31 |
}
|
|
|
9 |
"lint": "next lint"
|
10 |
},
|
11 |
"dependencies": {
|
12 |
+
"@prisma/client": "^5.5.2",
|
13 |
"classnames": "^2.3.2",
|
14 |
+
"filereader": "^0.10.3",
|
15 |
"framer-motion": "^10.16.4",
|
16 |
"next": "13.5.6",
|
17 |
"react": "^18",
|
|
|
20 |
"react-use": "^17.4.0"
|
21 |
},
|
22 |
"devDependencies": {
|
23 |
+
"@types/node": "^20.8.9",
|
24 |
"@types/react": "^18",
|
25 |
"@types/react-dom": "^18",
|
26 |
"autoprefixer": "^10",
|
27 |
"eslint": "^8",
|
28 |
"eslint-config-next": "13.5.6",
|
29 |
"postcss": "^8",
|
30 |
+
"prisma": "^5.5.2",
|
31 |
"tailwindcss": "^3",
|
32 |
+
"ts-node": "^10.9.1",
|
33 |
+
"typescript": "^5.2.2"
|
34 |
}
|
35 |
}
|
prisma/schema.prisma
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
generator client {
|
2 |
+
provider = "prisma-client-js"
|
3 |
+
}
|
4 |
+
|
5 |
+
datasource db {
|
6 |
+
provider = "sqlite"
|
7 |
+
url = "file:../data/dev.db"
|
8 |
+
}
|
9 |
+
|
10 |
+
model Image {
|
11 |
+
id Int @id @default(autoincrement())
|
12 |
+
prompt String
|
13 |
+
blob Bytes
|
14 |
+
}
|