Spaces:
Sleeping
Sleeping
Commit
•
6b27fdb
1
Parent(s):
0f203e8
wait.. what?
Browse files
src/app/engine/presets.ts
CHANGED
@@ -310,7 +310,77 @@ export const presets: Record<string, Preset> = {
|
|
310 |
"painting",
|
311 |
"3D render"
|
312 |
],
|
313 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
}
|
315 |
|
316 |
export type PresetName = keyof typeof presets
|
|
|
310 |
"painting",
|
311 |
"3D render"
|
312 |
],
|
313 |
+
},
|
314 |
+
render: {
|
315 |
+
label: "3D Render",
|
316 |
+
family: "european",
|
317 |
+
color: "color",
|
318 |
+
font: "actionman",
|
319 |
+
llmPrompt: "new movie",
|
320 |
+
imagePrompt: (prompt: string) => [
|
321 |
+
`3D render`,
|
322 |
+
`Blender`,
|
323 |
+
`3D animation`,
|
324 |
+
`Unreal engine`,
|
325 |
+
`${prompt}`,
|
326 |
+
],
|
327 |
+
negativePrompt: () => [
|
328 |
+
"manga",
|
329 |
+
"anime",
|
330 |
+
"american comic",
|
331 |
+
"grayscale",
|
332 |
+
"monochrome",
|
333 |
+
"painting"
|
334 |
+
],
|
335 |
+
},
|
336 |
+
/*
|
337 |
+
psx: {
|
338 |
+
label: "PSX",
|
339 |
+
family: "european",
|
340 |
+
color: "color",
|
341 |
+
font: "actionman",
|
342 |
+
llmPrompt: "new movie",
|
343 |
+
imagePrompt: (prompt: string) => [
|
344 |
+
`videogame screenshot`,
|
345 |
+
`3dfx`,
|
346 |
+
`3D dos game`,
|
347 |
+
`software rendering`,
|
348 |
+
`${prompt}`,
|
349 |
+
],
|
350 |
+
negativePrompt: () => [
|
351 |
+
"manga",
|
352 |
+
"anime",
|
353 |
+
"american comic",
|
354 |
+
"grayscale",
|
355 |
+
"monochrome",
|
356 |
+
"painting"
|
357 |
+
],
|
358 |
+
},
|
359 |
+
*/
|
360 |
+
/*
|
361 |
+
pixel: {
|
362 |
+
label: "Pixel",
|
363 |
+
family: "european",
|
364 |
+
color: "color",
|
365 |
+
font: "actionman",
|
366 |
+
llmPrompt: "new movie",
|
367 |
+
imagePrompt: (prompt: string) => [
|
368 |
+
`pixelart`,
|
369 |
+
`isometric`,
|
370 |
+
`pixelated`,
|
371 |
+
`low res`,
|
372 |
+
`${prompt}`,
|
373 |
+
],
|
374 |
+
negativePrompt: () => [
|
375 |
+
"manga",
|
376 |
+
"anime",
|
377 |
+
"american comic",
|
378 |
+
"grayscale",
|
379 |
+
"monochrome",
|
380 |
+
"painting"
|
381 |
+
],
|
382 |
+
},
|
383 |
+
*/
|
384 |
}
|
385 |
|
386 |
export type PresetName = keyof typeof presets
|
src/app/interface/panel/index.tsx
CHANGED
@@ -20,13 +20,11 @@ export function Panel({
|
|
20 |
className = "",
|
21 |
width = 1,
|
22 |
height = 1,
|
23 |
-
delay = 0,
|
24 |
}: {
|
25 |
panel: number
|
26 |
className?: string
|
27 |
width?: number
|
28 |
height?: number
|
29 |
-
delay?: number
|
30 |
}) {
|
31 |
const font = useStore(state => state.font)
|
32 |
const preset = useStore(state => state.preset)
|
@@ -47,6 +45,8 @@ export function Panel({
|
|
47 |
|
48 |
const timeoutRef = useRef<any>(null)
|
49 |
|
|
|
|
|
50 |
// since this run in its own loop, we need to use references everywhere
|
51 |
// but perhaps this could be refactored
|
52 |
useEffect(() => {
|
@@ -98,7 +98,7 @@ export function Panel({
|
|
98 |
clearTimeout(timeoutRef.current)
|
99 |
|
100 |
if (!renderedRef.current?.renderId || renderedRef.current?.status !== "pending") {
|
101 |
-
timeoutRef.current = setTimeout(checkStatus,
|
102 |
return
|
103 |
}
|
104 |
try {
|
@@ -116,14 +116,23 @@ export function Panel({
|
|
116 |
|
117 |
if (newRendered.status === "pending") {
|
118 |
// console.log("job not finished")
|
119 |
-
timeoutRef.current = setTimeout(checkStatus,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
} else {
|
121 |
console.log("panel finished!")
|
122 |
setGeneratingImages(panel, false)
|
123 |
}
|
124 |
} catch (err) {
|
125 |
console.error(err)
|
126 |
-
timeoutRef.current = setTimeout(checkStatus,
|
127 |
}
|
128 |
})
|
129 |
}
|
|
|
20 |
className = "",
|
21 |
width = 1,
|
22 |
height = 1,
|
|
|
23 |
}: {
|
24 |
panel: number
|
25 |
className?: string
|
26 |
width?: number
|
27 |
height?: number
|
|
|
28 |
}) {
|
29 |
const font = useStore(state => state.font)
|
30 |
const preset = useStore(state => state.preset)
|
|
|
45 |
|
46 |
const timeoutRef = useRef<any>(null)
|
47 |
|
48 |
+
const delay = 3000 + (1000 * panel)
|
49 |
+
|
50 |
// since this run in its own loop, we need to use references everywhere
|
51 |
// but perhaps this could be refactored
|
52 |
useEffect(() => {
|
|
|
98 |
clearTimeout(timeoutRef.current)
|
99 |
|
100 |
if (!renderedRef.current?.renderId || renderedRef.current?.status !== "pending") {
|
101 |
+
timeoutRef.current = setTimeout(checkStatus, delay)
|
102 |
return
|
103 |
}
|
104 |
try {
|
|
|
116 |
|
117 |
if (newRendered.status === "pending") {
|
118 |
// console.log("job not finished")
|
119 |
+
timeoutRef.current = setTimeout(checkStatus, delay)
|
120 |
+
} else if (newRendered.status === "error") {
|
121 |
+
console.log(`panel got an error :/ "${newRendered.error}", but let's try to recover..`)
|
122 |
+
try {
|
123 |
+
const newAttempt = await newRender({ prompt, width, height })
|
124 |
+
setRendered(renderedRef.current = newAttempt)
|
125 |
+
} catch (err) {
|
126 |
+
console.error("yeah sorry, something is wrong.. aborting")
|
127 |
+
setGeneratingImages(panel, false)
|
128 |
+
}
|
129 |
} else {
|
130 |
console.log("panel finished!")
|
131 |
setGeneratingImages(panel, false)
|
132 |
}
|
133 |
} catch (err) {
|
134 |
console.error(err)
|
135 |
+
timeoutRef.current = setTimeout(checkStatus, delay)
|
136 |
}
|
137 |
})
|
138 |
}
|
src/app/interface/progress/index.tsx
CHANGED
@@ -24,7 +24,7 @@ export function Progress({
|
|
24 |
|
25 |
// normally it takes 45, and we will try to go below,
|
26 |
// but to be safe let's set the counter a 1 min
|
27 |
-
const nbSeconds =
|
28 |
const amountInPercent = 100 / (nbUpdatesPerSec * nbSeconds) // 0.333
|
29 |
|
30 |
progressRef.current = Math.min(100, progressRef.current + amountInPercent)
|
|
|
24 |
|
25 |
// normally it takes 45, and we will try to go below,
|
26 |
// but to be safe let's set the counter a 1 min
|
27 |
+
const nbSeconds = 80 // 1 min
|
28 |
const amountInPercent = 100 / (nbUpdatesPerSec * nbSeconds) // 0.333
|
29 |
|
30 |
progressRef.current = Math.min(100, progressRef.current + amountInPercent)
|