Spaces:
Sleeping
Sleeping
File size: 1,499 Bytes
faf4ba4 c32ec0d faf4ba4 c380867 faf4ba4 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 |
import { GeneratedPanel } from "@/types"
export function dirtyGeneratedPanelCleaner({
panel,
instructions,
caption
}: GeneratedPanel): GeneratedPanel {
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,
}
} |