Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
ace5a12
1
Parent(s):
27974c0
we only support non-animated panels for now
Browse files- src/app/engine/presets.ts +14 -0
- src/app/engine/render.ts +5 -1
- src/app/interface/panel/index.tsx +18 -3
src/app/engine/presets.ts
CHANGED
@@ -48,6 +48,20 @@ export const presets: Record<string, Preset> = {
|
|
48 |
],
|
49 |
negativePrompt: () => [ ],
|
50 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
japanese_manga: {
|
52 |
id: "japanese_manga",
|
53 |
label: "Japanese",
|
|
|
48 |
],
|
49 |
negativePrompt: () => [ ],
|
50 |
},
|
51 |
+
/*
|
52 |
+
video_3d_style: {
|
53 |
+
id: "video_3d_style",
|
54 |
+
label: "[video] 3D style",
|
55 |
+
family: "european",
|
56 |
+
color: "color",
|
57 |
+
font: "actionman",
|
58 |
+
llmPrompt: "new movie",
|
59 |
+
imagePrompt: (prompt: string) => [
|
60 |
+
prompt,
|
61 |
+
],
|
62 |
+
negativePrompt: () => [ ],
|
63 |
+
},
|
64 |
+
*/
|
65 |
japanese_manga: {
|
66 |
id: "japanese_manga",
|
67 |
label: "Japanese",
|
src/app/engine/render.ts
CHANGED
@@ -32,6 +32,7 @@ const serverOpenaiApiModel = `${process.env.RENDERING_OPENAI_API_MODEL || "dall-
|
|
32 |
export async function newRender({
|
33 |
prompt,
|
34 |
// negativePrompt,
|
|
|
35 |
width,
|
36 |
height,
|
37 |
withCache,
|
@@ -41,6 +42,7 @@ export async function newRender({
|
|
41 |
// negativePrompt: string[]
|
42 |
width: number
|
43 |
height: number
|
|
|
44 |
withCache: boolean
|
45 |
settings: Settings
|
46 |
}) {
|
@@ -392,7 +394,9 @@ export async function newRender({
|
|
392 |
body: JSON.stringify({
|
393 |
prompt,
|
394 |
// negativePrompt, unused for now
|
395 |
-
|
|
|
|
|
396 |
nbSteps: nbInferenceSteps, // 20 = fast, 30 = better, 50 = best
|
397 |
actionnables: [], // ["text block"],
|
398 |
segmentation: "disabled", // "firstframe", // one day we will remove this param, to make it automatic
|
|
|
32 |
export async function newRender({
|
33 |
prompt,
|
34 |
// negativePrompt,
|
35 |
+
nbFrames,
|
36 |
width,
|
37 |
height,
|
38 |
withCache,
|
|
|
42 |
// negativePrompt: string[]
|
43 |
width: number
|
44 |
height: number
|
45 |
+
nbFrames: number
|
46 |
withCache: boolean
|
47 |
settings: Settings
|
48 |
}) {
|
|
|
394 |
body: JSON.stringify({
|
395 |
prompt,
|
396 |
// negativePrompt, unused for now
|
397 |
+
|
398 |
+
nbFrames,
|
399 |
+
|
400 |
nbSteps: nbInferenceSteps, // 20 = fast, 30 = better, 50 = best
|
401 |
actionnables: [], // ["text block"],
|
402 |
segmentation: "disabled", // "firstframe", // one day we will remove this param, to make it automatic
|
src/app/interface/panel/index.tsx
CHANGED
@@ -99,10 +99,22 @@ export function Panel({
|
|
99 |
delay += 8000
|
100 |
}
|
101 |
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
prompt: string
|
104 |
width: number
|
105 |
height: number
|
|
|
106 |
revision: number
|
107 |
}) => {
|
108 |
if (!prompt?.length) { return }
|
@@ -134,6 +146,7 @@ export function Panel({
|
|
134 |
prompt: cacheInvalidationHack + " " + prompt,
|
135 |
width,
|
136 |
height,
|
|
|
137 |
|
138 |
// TODO: here we never reset the revision, so only the first user
|
139 |
// comic will be cached (we should fix that later)
|
@@ -151,6 +164,7 @@ export function Panel({
|
|
151 |
prompt: cacheInvalidationHack + " " + prompt,
|
152 |
width,
|
153 |
height,
|
|
|
154 |
withCache,
|
155 |
settings: getSettings(),
|
156 |
})
|
@@ -230,6 +244,7 @@ export function Panel({
|
|
230 |
prompt,
|
231 |
width,
|
232 |
height,
|
|
|
233 |
withCache: false,
|
234 |
settings: getSettings(),
|
235 |
})
|
@@ -257,7 +272,7 @@ export function Panel({
|
|
257 |
useEffect(() => {
|
258 |
if (!prompt.length) { return }
|
259 |
|
260 |
-
startImageGeneration({ prompt, width, height, revision })
|
261 |
|
262 |
clearTimeout(timeoutRef.current)
|
263 |
|
@@ -267,7 +282,7 @@ export function Panel({
|
|
267 |
return () => {
|
268 |
clearTimeout(timeoutRef.current)
|
269 |
}
|
270 |
-
}, [prompt, width, height, revision])
|
271 |
|
272 |
/*
|
273 |
doing the captionning from the browser is expensive
|
|
|
99 |
delay += 8000
|
100 |
}
|
101 |
|
102 |
+
// nbFrames == 1 -> image
|
103 |
+
// nbFrames >= 2 -> video
|
104 |
+
// for AnimateLCM (the current supported engine)
|
105 |
+
// the value is between 12 and 20, default is 16
|
106 |
+
// This is not the ideal wait to configure this,
|
107 |
+
// but the AI Comic Factory is a just a prototype, so it will do
|
108 |
+
|
109 |
+
const nbFrames = preset.id.startsWith("video")
|
110 |
+
? 16
|
111 |
+
: 1
|
112 |
+
|
113 |
+
const startImageGeneration = ({ prompt, width, height, nbFrames, revision }: {
|
114 |
prompt: string
|
115 |
width: number
|
116 |
height: number
|
117 |
+
nbFrames: number
|
118 |
revision: number
|
119 |
}) => {
|
120 |
if (!prompt?.length) { return }
|
|
|
146 |
prompt: cacheInvalidationHack + " " + prompt,
|
147 |
width,
|
148 |
height,
|
149 |
+
nbFrames,
|
150 |
|
151 |
// TODO: here we never reset the revision, so only the first user
|
152 |
// comic will be cached (we should fix that later)
|
|
|
164 |
prompt: cacheInvalidationHack + " " + prompt,
|
165 |
width,
|
166 |
height,
|
167 |
+
nbFrames,
|
168 |
withCache,
|
169 |
settings: getSettings(),
|
170 |
})
|
|
|
244 |
prompt,
|
245 |
width,
|
246 |
height,
|
247 |
+
nbFrames,
|
248 |
withCache: false,
|
249 |
settings: getSettings(),
|
250 |
})
|
|
|
272 |
useEffect(() => {
|
273 |
if (!prompt.length) { return }
|
274 |
|
275 |
+
startImageGeneration({ prompt, width, height, nbFrames, revision })
|
276 |
|
277 |
clearTimeout(timeoutRef.current)
|
278 |
|
|
|
282 |
return () => {
|
283 |
clearTimeout(timeoutRef.current)
|
284 |
}
|
285 |
+
}, [prompt, width, height, nbFrames, revision])
|
286 |
|
287 |
/*
|
288 |
doing the captionning from the browser is expensive
|