Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
save instance prompt. needed for generation
Browse files
prisma/schema.prisma
CHANGED
@@ -11,17 +11,18 @@ datasource db {
|
|
11 |
}
|
12 |
|
13 |
model Model {
|
14 |
-
id
|
15 |
-
createdAt
|
16 |
-
title
|
17 |
-
image
|
18 |
-
likes
|
19 |
-
downloads
|
20 |
-
|
21 |
-
|
22 |
-
userId
|
23 |
-
|
24 |
-
|
|
|
25 |
}
|
26 |
|
27 |
model Gallery {
|
|
|
11 |
}
|
12 |
|
13 |
model Model {
|
14 |
+
id String @id
|
15 |
+
createdAt DateTime @default(now())
|
16 |
+
title String
|
17 |
+
image String
|
18 |
+
likes Int?
|
19 |
+
downloads Int?
|
20 |
+
instance_prompt String?
|
21 |
+
isPublic Boolean @default(false)
|
22 |
+
user User? @relation(fields: [userId], references: [sub])
|
23 |
+
userId String?
|
24 |
+
gallery Gallery[]
|
25 |
+
comments Comment[]
|
26 |
}
|
27 |
|
28 |
model Gallery {
|
src/lib/components/models/drawer/Drawer.svelte
CHANGED
@@ -31,7 +31,6 @@
|
|
31 |
};
|
32 |
|
33 |
const handleClickNext = () => {
|
34 |
-
// scroll into view
|
35 |
const element = document.getElementById('gallery_examples');
|
36 |
element?.scrollBy({
|
37 |
left: 300,
|
|
|
31 |
};
|
32 |
|
33 |
const handleClickNext = () => {
|
|
|
34 |
const element = document.getElementById('gallery_examples');
|
35 |
element?.scrollBy({
|
36 |
left: 300,
|
src/lib/type.ts
CHANGED
@@ -21,6 +21,7 @@ export interface ModelCard {
|
|
21 |
likes: number,
|
22 |
downloads: number,
|
23 |
image: string,
|
|
|
24 |
gallery?: CommunityCard[],
|
25 |
comments?: CommentType[],
|
26 |
infos?: {
|
|
|
21 |
likes: number,
|
22 |
downloads: number,
|
23 |
image: string,
|
24 |
+
instance_prompt?: string,
|
25 |
gallery?: CommunityCard[],
|
26 |
comments?: CommentType[],
|
27 |
infos?: {
|
src/routes/api/bulk-create-models/+server.ts
CHANGED
@@ -27,6 +27,7 @@ export async function POST({ request }) {
|
|
27 |
id: model.repo,
|
28 |
title: model.title,
|
29 |
likes: data.likes,
|
|
|
30 |
downloads: data.downloads,
|
31 |
}
|
32 |
return mergedData
|
@@ -40,6 +41,7 @@ export async function POST({ request }) {
|
|
40 |
image: model.image,
|
41 |
title: model.title,
|
42 |
likes: model.likes,
|
|
|
43 |
downloads: model.downloads,
|
44 |
isPublic: true,
|
45 |
}
|
|
|
27 |
id: model.repo,
|
28 |
title: model.title,
|
29 |
likes: data.likes,
|
30 |
+
instance_prompt: data?.cardData?.instance_prompt ?? null,
|
31 |
downloads: data.downloads,
|
32 |
}
|
33 |
return mergedData
|
|
|
41 |
image: model.image,
|
42 |
title: model.title,
|
43 |
likes: model.likes,
|
44 |
+
instance_prompt: model.instance_prompt,
|
45 |
downloads: model.downloads,
|
46 |
isPublic: true,
|
47 |
}
|
src/routes/api/models/[id]/+server.ts
CHANGED
@@ -13,46 +13,50 @@ export async function GET({ url, params } : RequestEvent) {
|
|
13 |
where: {
|
14 |
id,
|
15 |
},
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
},
|
30 |
-
where: {
|
31 |
-
isPublic: true
|
32 |
-
},
|
33 |
-
orderBy: {
|
34 |
-
createdAt: 'desc'
|
35 |
-
},
|
36 |
-
take: 10
|
37 |
},
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
}
|
53 |
}
|
54 |
}
|
55 |
-
}
|
|
|
|
|
|
|
|
|
|
|
56 |
})
|
57 |
|
58 |
if (!model) {
|
|
|
13 |
where: {
|
14 |
id,
|
15 |
},
|
16 |
+
select: full ? {
|
17 |
+
id: true,
|
18 |
+
likes: true,
|
19 |
+
downloads: true,
|
20 |
+
image: true,
|
21 |
+
title: true,
|
22 |
+
instance_prompt: true,
|
23 |
+
gallery: {
|
24 |
+
select: {
|
25 |
+
id: true,
|
26 |
+
prompt: true,
|
27 |
+
image: true,
|
28 |
+
createdAt: true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
},
|
30 |
+
where: {
|
31 |
+
isPublic: true
|
32 |
+
},
|
33 |
+
orderBy: {
|
34 |
+
createdAt: 'desc'
|
35 |
+
},
|
36 |
+
take: 10
|
37 |
+
},
|
38 |
+
comments: {
|
39 |
+
select: {
|
40 |
+
id: true,
|
41 |
+
createdAt: true,
|
42 |
+
text: true,
|
43 |
+
user: {
|
44 |
+
select: {
|
45 |
+
id: true,
|
46 |
+
name: true,
|
47 |
+
sub: true,
|
48 |
+
picture: true,
|
49 |
+
preferred_username: true,
|
50 |
}
|
51 |
}
|
52 |
}
|
53 |
}
|
54 |
+
} : {
|
55 |
+
instance_prompt: true,
|
56 |
+
image: true,
|
57 |
+
title: true,
|
58 |
+
id: true,
|
59 |
+
}
|
60 |
})
|
61 |
|
62 |
if (!model) {
|
src/routes/generate/+page.svelte
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
|
21 |
let form = ((data?.model?.id && generation?.form?.model?.id && data?.model?.id !== generation?.form?.model?.id) || !generation?.form) ? {
|
22 |
model: data?.model ?? null,
|
23 |
-
inputs: "",
|
24 |
parameters: {
|
25 |
negative_prompt: ""
|
26 |
}
|
|
|
20 |
|
21 |
let form = ((data?.model?.id && generation?.form?.model?.id && data?.model?.id !== generation?.form?.model?.id) || !generation?.form) ? {
|
22 |
model: data?.model ?? null,
|
23 |
+
inputs: data?.model?.instance_prompt ?? "",
|
24 |
parameters: {
|
25 |
negative_prompt: ""
|
26 |
}
|