Commit
•
c1039c9
1
Parent(s):
d1182ea
up
Browse files
public/images/models/sdxl-cyberpunk-2077.jpg
ADDED
src/app/firehose/page.tsx
CHANGED
@@ -23,7 +23,7 @@ export default function FirehosePage() {
|
|
23 |
useEffect(() => {
|
24 |
startTransition(async () => {
|
25 |
const newPosts = await getLatestPosts({
|
26 |
-
maxNbPosts:
|
27 |
shuffle: false,
|
28 |
})
|
29 |
setPosts(newPosts)
|
|
|
23 |
useEffect(() => {
|
24 |
startTransition(async () => {
|
25 |
const newPosts = await getLatestPosts({
|
26 |
+
maxNbPosts: 80,
|
27 |
shuffle: false,
|
28 |
})
|
29 |
setPosts(newPosts)
|
src/app/server/actions/community.ts
CHANGED
@@ -101,7 +101,7 @@ export async function postToCommunity({
|
|
101 |
|
102 |
export async function getLatestPosts({
|
103 |
visibility,
|
104 |
-
maxNbPosts =
|
105 |
shuffle = true,
|
106 |
}: {
|
107 |
visibility?: PostVisibility
|
@@ -122,6 +122,10 @@ export async function getLatestPosts({
|
|
122 |
// TODO: send the max number of posts
|
123 |
const res = await fetch(`${apiUrl}/posts/${appId}/${
|
124 |
visibility || "all"
|
|
|
|
|
|
|
|
|
125 |
}`, {
|
126 |
method: "GET",
|
127 |
headers: {
|
@@ -149,13 +153,7 @@ export async function getLatestPosts({
|
|
149 |
|
150 |
const posts: Post[] = Array.isArray(response?.posts) ? response?.posts : []
|
151 |
|
152 |
-
|
153 |
-
shuffleArray(posts)
|
154 |
-
} else {
|
155 |
-
posts.sort((a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt))
|
156 |
-
}
|
157 |
-
|
158 |
-
return posts.slice(0, maxNbPosts)
|
159 |
} catch (err) {
|
160 |
// const error = `failed to get posts: ${err}`
|
161 |
// console.error(error)
|
|
|
101 |
|
102 |
export async function getLatestPosts({
|
103 |
visibility,
|
104 |
+
maxNbPosts = 80,
|
105 |
shuffle = true,
|
106 |
}: {
|
107 |
visibility?: PostVisibility
|
|
|
122 |
// TODO: send the max number of posts
|
123 |
const res = await fetch(`${apiUrl}/posts/${appId}/${
|
124 |
visibility || "all"
|
125 |
+
}/${
|
126 |
+
maxNbPosts || 80
|
127 |
+
}/${
|
128 |
+
!!shuffle
|
129 |
}`, {
|
130 |
method: "GET",
|
131 |
headers: {
|
|
|
153 |
|
154 |
const posts: Post[] = Array.isArray(response?.posts) ? response?.posts : []
|
155 |
|
156 |
+
return posts
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
} catch (err) {
|
158 |
// const error = `failed to get posts: ${err}`
|
159 |
// console.error(error)
|
src/app/server/actions/models.ts
CHANGED
@@ -22,6 +22,7 @@ export async function getSDXLModels(): Promise<SDXLModel[]> {
|
|
22 |
const compatibleModels = content.filter(model => model.is_compatible)
|
23 |
|
24 |
const hardcoded: SDXLModel[] = [
|
|
|
25 |
{
|
26 |
"image": "https://jbilcke-hf-ai-clip-factory.hf.space/images/models/sdxl-modern-pixar.jpg",
|
27 |
"title": "sdxl-modern-pixar",
|
@@ -32,6 +33,17 @@ export async function getSDXLModels(): Promise<SDXLModel[]> {
|
|
32 |
"likes": 0,
|
33 |
"downloads": 0
|
34 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
{
|
36 |
"image": "https://jbilcke-hf-ai-clip-factory.hf.space/images/models/sdxl-cinematic-2.jpg",
|
37 |
"title": "sdxl-cinematic-2",
|
|
|
22 |
const compatibleModels = content.filter(model => model.is_compatible)
|
23 |
|
24 |
const hardcoded: SDXLModel[] = [
|
25 |
+
/*
|
26 |
{
|
27 |
"image": "https://jbilcke-hf-ai-clip-factory.hf.space/images/models/sdxl-modern-pixar.jpg",
|
28 |
"title": "sdxl-modern-pixar",
|
|
|
33 |
"likes": 0,
|
34 |
"downloads": 0
|
35 |
},
|
36 |
+
*/
|
37 |
+
{
|
38 |
+
"image": "https://jbilcke-hf-ai-clip-factory.hf.space/images/models/sdxl-cyberpunk-2077.jpg",
|
39 |
+
"title": "sdxl-cyberpunk-2077",
|
40 |
+
"repo": "jbilcke-hf/sdxl-cyberpunk-2077",
|
41 |
+
"trigger_word": "cyberpunk-2077",
|
42 |
+
"weights": "pytorch_lora_weights.safetensors",
|
43 |
+
"is_compatible": true,
|
44 |
+
"likes": 0,
|
45 |
+
"downloads": 0
|
46 |
+
},
|
47 |
{
|
48 |
"image": "https://jbilcke-hf-ai-clip-factory.hf.space/images/models/sdxl-cinematic-2.jpg",
|
49 |
"title": "sdxl-cinematic-2",
|
src/app/server/utils/shuffleArray.ts
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
-
export
|
2 |
for (let i = items.length - 1; i > 0; i--) {
|
3 |
const j = Math.floor(Math.random() * (i + 1));
|
4 |
const temp = items[i];
|
5 |
items[i] = items[j];
|
6 |
items[j] = temp;
|
7 |
}
|
|
|
|
|
8 |
}
|
|
|
1 |
+
export function shuffleArray<T>(items: T[]): T[] {
|
2 |
for (let i = items.length - 1; i > 0; i--) {
|
3 |
const j = Math.floor(Math.random() * (i + 1));
|
4 |
const temp = items[i];
|
5 |
items[i] = items[j];
|
6 |
items[j] = temp;
|
7 |
}
|
8 |
+
|
9 |
+
return items
|
10 |
}
|