Spaces:
Sleeping
Sleeping
Commit
·
c380867
1
Parent(s):
c51d86a
seems to work
Browse files- src/app/engine/presets.ts +8 -8
- src/app/main.tsx +6 -1
- src/lib/dirtyCaptionCleaner.ts +23 -15
src/app/engine/presets.ts
CHANGED
|
@@ -51,7 +51,7 @@ export const presets: Record<string, Preset> = {
|
|
| 51 |
"grayscale",
|
| 52 |
"intricate",
|
| 53 |
"detailed",
|
| 54 |
-
"drawing"
|
| 55 |
],
|
| 56 |
negativePrompt: () => [
|
| 57 |
"franco-belgian comic",
|
|
@@ -75,7 +75,7 @@ export const presets: Record<string, Preset> = {
|
|
| 75 |
"bande dessinée",
|
| 76 |
"franco-belgian comic",
|
| 77 |
"comic album",
|
| 78 |
-
"color drawing"
|
| 79 |
],
|
| 80 |
negativePrompt: () => [
|
| 81 |
"manga",
|
|
@@ -103,7 +103,7 @@ export const presets: Record<string, Preset> = {
|
|
| 103 |
"2010s",
|
| 104 |
"digital print",
|
| 105 |
"color comicbook",
|
| 106 |
-
"color drawing"
|
| 107 |
],
|
| 108 |
negativePrompt: () => [
|
| 109 |
"manga",
|
|
@@ -163,7 +163,7 @@ export const presets: Record<string, Preset> = {
|
|
| 163 |
"1950",
|
| 164 |
"50s",
|
| 165 |
"color comicbook",
|
| 166 |
-
"color drawing"
|
| 167 |
],
|
| 168 |
negativePrompt: () => [
|
| 169 |
"manga",
|
|
@@ -226,7 +226,7 @@ export const presets: Record<string, Preset> = {
|
|
| 226 |
"pulp science fiction",
|
| 227 |
"vintage science fiction",
|
| 228 |
"single panel",
|
| 229 |
-
"comic album"
|
| 230 |
],
|
| 231 |
negativePrompt: () => [
|
| 232 |
"manga",
|
|
@@ -256,7 +256,7 @@ export const presets: Record<string, Preset> = {
|
|
| 256 |
"franco-belgian style",
|
| 257 |
"bande dessinée",
|
| 258 |
"single panel",
|
| 259 |
-
"comic album"
|
| 260 |
],
|
| 261 |
negativePrompt: () => [
|
| 262 |
"manga",
|
|
@@ -287,7 +287,7 @@ export const presets: Record<string, Preset> = {
|
|
| 287 |
"color panel",
|
| 288 |
"bande dessinée",
|
| 289 |
"single panel",
|
| 290 |
-
"comic album"
|
| 291 |
],
|
| 292 |
negativePrompt: () => [
|
| 293 |
"manga",
|
|
@@ -318,7 +318,7 @@ export const presets: Record<string, Preset> = {
|
|
| 318 |
"single panel",
|
| 319 |
"comical",
|
| 320 |
"comic album",
|
| 321 |
-
"color drawing"
|
| 322 |
],
|
| 323 |
negativePrompt: () => [
|
| 324 |
"manga",
|
|
|
|
| 51 |
"grayscale",
|
| 52 |
"intricate",
|
| 53 |
"detailed",
|
| 54 |
+
// "drawing"
|
| 55 |
],
|
| 56 |
negativePrompt: () => [
|
| 57 |
"franco-belgian comic",
|
|
|
|
| 75 |
"bande dessinée",
|
| 76 |
"franco-belgian comic",
|
| 77 |
"comic album",
|
| 78 |
+
// "color drawing"
|
| 79 |
],
|
| 80 |
negativePrompt: () => [
|
| 81 |
"manga",
|
|
|
|
| 103 |
"2010s",
|
| 104 |
"digital print",
|
| 105 |
"color comicbook",
|
| 106 |
+
// "color drawing"
|
| 107 |
],
|
| 108 |
negativePrompt: () => [
|
| 109 |
"manga",
|
|
|
|
| 163 |
"1950",
|
| 164 |
"50s",
|
| 165 |
"color comicbook",
|
| 166 |
+
// "color drawing"
|
| 167 |
],
|
| 168 |
negativePrompt: () => [
|
| 169 |
"manga",
|
|
|
|
| 226 |
"pulp science fiction",
|
| 227 |
"vintage science fiction",
|
| 228 |
"single panel",
|
| 229 |
+
// "comic album"
|
| 230 |
],
|
| 231 |
negativePrompt: () => [
|
| 232 |
"manga",
|
|
|
|
| 256 |
"franco-belgian style",
|
| 257 |
"bande dessinée",
|
| 258 |
"single panel",
|
| 259 |
+
// "comic album"
|
| 260 |
],
|
| 261 |
negativePrompt: () => [
|
| 262 |
"manga",
|
|
|
|
| 287 |
"color panel",
|
| 288 |
"bande dessinée",
|
| 289 |
"single panel",
|
| 290 |
+
// "comic album"
|
| 291 |
],
|
| 292 |
negativePrompt: () => [
|
| 293 |
"manga",
|
|
|
|
| 318 |
"single panel",
|
| 319 |
"comical",
|
| 320 |
"comic album",
|
| 321 |
+
// "color drawing"
|
| 322 |
],
|
| 323 |
negativePrompt: () => [
|
| 324 |
"manga",
|
src/app/main.tsx
CHANGED
|
@@ -44,7 +44,12 @@ export default function Main() {
|
|
| 44 |
const llmResponse = await getStory({ preset, prompt })
|
| 45 |
console.log("response:", llmResponse)
|
| 46 |
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
console.log("panel prompt prefix:", panelPromptPrefix)
|
| 49 |
|
| 50 |
const nbPanels = 4
|
|
|
|
| 44 |
const llmResponse = await getStory({ preset, prompt })
|
| 45 |
console.log("response:", llmResponse)
|
| 46 |
|
| 47 |
+
// we have to limit the size of the prompt, otherwise the rest of the style won't be followed
|
| 48 |
+
|
| 49 |
+
let limitedPrompt = prompt.slice(0, 77)
|
| 50 |
+
console.log("had to cut the length og the prompt to:", limitedPrompt)
|
| 51 |
+
|
| 52 |
+
const panelPromptPrefix = preset.imagePrompt(limitedPrompt).join(", ")
|
| 53 |
console.log("panel prompt prefix:", panelPromptPrefix)
|
| 54 |
|
| 55 |
const nbPanels = 4
|
src/lib/dirtyCaptionCleaner.ts
CHANGED
|
@@ -7,22 +7,30 @@ export function dirtyCaptionCleaner({
|
|
| 7 |
instructions: string;
|
| 8 |
caption: string
|
| 9 |
}) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
return {
|
| 11 |
panel,
|
| 12 |
-
instructions:
|
| 13 |
-
|
| 14 |
-
(instructions.split(":").pop() || "")
|
| 15 |
-
.replaceAll("Show a", "")
|
| 16 |
-
.replaceAll("Show the", "")
|
| 17 |
-
.replaceAll("Opens with a", "")
|
| 18 |
-
.replaceAll("Opens with the", "")
|
| 19 |
-
.replaceAll("Opens with", "")
|
| 20 |
-
.replaceAll("Cut to a", "")
|
| 21 |
-
.replaceAll("Cut to the", "")
|
| 22 |
-
.replaceAll("Cut to", "")
|
| 23 |
-
.replaceAll("End with a", "")
|
| 24 |
-
.replaceAll("End with", "").trim() || ""
|
| 25 |
-
),
|
| 26 |
-
caption: caption.split(":").pop()?.trim() || "",
|
| 27 |
}
|
| 28 |
}
|
|
|
|
| 7 |
instructions: string;
|
| 8 |
caption: string
|
| 9 |
}) {
|
| 10 |
+
let newCaption = caption.split(":").pop()?.trim() || ""
|
| 11 |
+
let newInstructions = (
|
| 12 |
+
// need to remove from LLM garbage here, too
|
| 13 |
+
(instructions.split(":").pop() || "")
|
| 14 |
+
.replaceAll("Show a", "")
|
| 15 |
+
.replaceAll("Show the", "")
|
| 16 |
+
.replaceAll("Opens with a", "")
|
| 17 |
+
.replaceAll("Opens with the", "")
|
| 18 |
+
.replaceAll("Opens with", "")
|
| 19 |
+
.replaceAll("Cut to a", "")
|
| 20 |
+
.replaceAll("Cut to the", "")
|
| 21 |
+
.replaceAll("Cut to", "")
|
| 22 |
+
.replaceAll("End with a", "")
|
| 23 |
+
.replaceAll("End with", "").trim() || ""
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
// we have to crop the instructions unfortunately, otherwise the style will disappear
|
| 27 |
+
newInstructions = newInstructions.slice(0, 77)
|
| 28 |
+
|
| 29 |
+
// american comic about brunette wood elf walks around a dark forrest and suddenly stops when hearing a strange noise, single panel, modern american comic, comicbook style, 2010s, digital print, color comicbook, color drawing, Full shot of the elf, her eyes widening in surprise, as a glowing, ethereal creature steps out of the shadows.",
|
| 30 |
+
|
| 31 |
return {
|
| 32 |
panel,
|
| 33 |
+
instructions: newInstructions,
|
| 34 |
+
caption: newCaption,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
}
|
| 36 |
}
|