Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 1,460 Bytes
c32ec0d c380867 0fb0f13 c380867 3f94588 c380867 c32ec0d c380867 c32ec0d 2f7798c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
export function dirtyCaptionCleaner({
panel,
instructions,
caption
}: {
panel: number;
instructions: string;
caption: string
}) {
let newCaption = caption.split(":").pop()?.trim() || ""
let newInstructions = (
// need to remove from LLM garbage here, too
(instructions.split(":").pop() || "")
.replaceAll("Draw a", "")
.replaceAll("Draw the", "")
.replaceAll("Draw", "")
.replaceAll("Show a", "")
.replaceAll("Show the", "")
.replaceAll("Opens with a", "")
.replaceAll("Opens with the", "")
.replaceAll("Opens with", "")
.replaceAll("Cut to a", "")
.replaceAll("Cut to the", "")
.replaceAll("Cut to", "")
.replaceAll("End with a", "")
.replaceAll("End with", "").trim() || ""
)
// we have to crop the instructions unfortunately, otherwise the style will disappear
// newInstructions = newInstructions.slice(0, 77)
// EDIT: well actually the instructions are already at the end of the prompt,
// so we can let SDXL do this cropping job for us
// 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.",
return {
panel,
instructions: newInstructions,
caption: newCaption,
}
} |