Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Originals O2: a Soul run makes what it was asked for on either engine

Claude74e82da781ff
diff --git a/src/components/studio/soul-finish.ts b/src/components/studio/soul-finish.ts
index c2e43efe..2859771a 100644
--- a/src/components/studio/soul-finish.ts
+++ b/src/components/studio/soul-finish.ts
@@ -4,16 +4,20 @@ import { useQueryClient } from "@tanstack/react-query";
import { useEffect } from "react";
import { applyPreset, PRESETS } from "@/lib/grade";
import type { Generation } from "@/lib/catalog/types";
-import { finishSteps, outputsToFinish, overlayLayout, type FinishSteps } from "@/lib/soul-post";
+import { cropRect, finishSteps, outputsToFinish, overlayLayout, type FinishSteps } from "@/lib/soul-post";
/**
- * Fuobe Soul's post steps in the browser (research §4.4): when a result with a look arrives, its grade (the
- * WebGL grade of the Color grading tool) and its overlay are applied once, and the finished picture is kept
+ * Fuobe Soul's post steps in the browser (research §4.4): when a result with a look arrives, Soul Cinema's 21:9
+ * crop, its grade (the WebGL grade of the Color grading tool) and its overlay are applied once, and the finished picture is kept
* on the server in place of the raw one (the raw one stays as meta.original). Any open studio feed does it;
* the server takes the first and answers the others 409.
*/
const started = new Set<string>();
+/** Outputs that failed to finish (no WebGL, a picture that won't load): tried again after a pause, a few times. */
+const failed = new Map<string, { tries: number; at: number }>();
+const MAX_TRIES = 3;
+const RETRY_MS = 30_000;
function load(url: string): Promise<HTMLImageElement> {
return new Promise((resolve, reject) => {
@@ -31,9 +35,11 @@ const FONTS = { mono: '"Courier New", ui-monospace, monospace', serif: 'Georgia,
async function finish(url: string, steps: FinishSteps, when: Date): Promise<Blob> {
const img = await load(url);
let canvas = document.createElement("canvas");
- canvas.width = img.naturalWidth;
- canvas.height = img.naturalHeight;
- canvas.getContext("2d")!.drawImage(img, 0, 0);
+ // Soul Cinema's 21:9: the middle band of the 16:9 picture.
+ const r = steps.crop ? cropRect(img.naturalWidth, img.naturalHeight, steps.crop) : { x: 0, y: 0, width: img.naturalWidth, height: img.naturalHeight };
+ canvas.width = r.width;
+ canvas.height = r.height;
+ canvas.getContext("2d")!.drawImage(img, r.x, r.y, r.width, r.height, 0, 0, r.width, r.height);
const preset = steps.grade ? PRESETS.find((p) => p.id === steps.grade) : undefined;
if (preset) {
const { LayerGrader } = await import("@/components/layers/grade-gl");
@@ -78,6 +84,9 @@ export function useSoulFinish(items: Generation[]) {
for (const i of outputsToFinish(g)) {
const key = `${g.id}:${i}`;
if (started.has(key)) continue;
+ // A failure is tried again after a pause that doubles, and not after the third: each try loads the full picture.
+ const f = failed.get(key);
+ if (f && (f.tries >= MAX_TRIES || Date.now() - f.at < RETRY_MS * 2 ** (f.tries - 1))) continue;
started.add(key);
const steps = finishSteps(g.outputs[i])!;
void (async () => {
@@ -88,10 +97,12 @@ export function useSoulFinish(items: Generation[]) {
form.append("index", String(i));
const res = await fetch(`/api/generations/${g.id}/finish`, { method: "POST", body: form });
// The live stream brings the finished row; a feed without it refetches.
+ failed.delete(key);
if (res.ok) void qc.invalidateQueries({ queryKey: ["generations"] });
} catch (e) {
- // The raw picture stays; it is finished next time a feed shows it.
+ // The raw picture stays; a feed showing it later tries again (after a pause, at most three times).
started.delete(key);
+ failed.set(key, { tries: (f?.tries ?? 0) + 1, at: Date.now() });
console.warn(`[fuobe] couldn't finish ${g.id}: ${(e as Error).message}`);
}
})();
diff --git a/src/lib/catalog/models.ts b/src/lib/catalog/models.ts
index 845454bc..9baf123e 100644
--- a/src/lib/catalog/models.ts
+++ b/src/lib/catalog/models.ts
@@ -3,7 +3,7 @@ import { HIGGSFIELD_MODELS, HIGGSFIELD_ROUTES } from "./higgsfield-models.genera
import { pricingAt } from "./plan";
import { DEFAULT_FPS_TARGET, FPS_TARGETS, SLOW_MOTION } from "@/lib/av/fps";
import { ASR_LANGUAGES, WHISPER_LANGUAGES } from "../speech-languages";
-import { SOUL_ASPECTS, SOUL_TIERS } from "./soul";
+import { CINEMA_CROP, SOUL_ASPECTS, SOUL_TIERS } from "./soul";
import { LAST_FRAME_CHAIN, type ModelDef, type ModelOptions, type ModelRoute, type Operation } from "./types";
/*
@@ -1497,7 +1497,8 @@ const originals: ModelDef[] = [
original({
id: "fuobe-soul-cinema",
open: [comfy("t2i", "z-image-turbo-t2i", "Z-Image Turbo with the film-still LoRAs")],
- options: SOUL_OPTIONS,
+ // 21:9 is a crop of the 16:9 picture, made after generation (research §4.5).
+ options: { ...SOUL_OPTIONS, aspectRatios: [...SOUL_ASPECTS, CINEMA_CROP] },
}),
];
diff --git a/src/lib/catalog/palettes.ts b/src/lib/catalog/palettes.ts
index 05e0c73c..5ea00f56 100644
--- a/src/lib/catalog/palettes.ts
+++ b/src/lib/catalog/palettes.ts
@@ -23,7 +23,7 @@
* `request.prompt`: they ride in `request.signature.words`, which the server adds when it plans the
* run, so feeds, Library titles and Reuse keep the user's own words.
*/
-import { lookCard, SOUL_MODEL_IDS } from "./soul-cards";
+import { DEFAULT_LOOK, lookCard, SOUL_MODEL_IDS } from "./soul-cards";
import type { GenerationRequest, GenParams, ModelDef, Operation } from "./types";
export type RGB = [number, number, number];
@@ -428,18 +428,27 @@ export function styleLegend(from: number, to: number): string {
return `Use ${which} only as a style reference: match their colour palette, light, texture, grain and mood, but don't copy their subjects or layout.`;
}
+/** Takes a Fuobe Soul look as its presetId (Fuobe Soul, Soul HD); a look id means nothing to any other model. */
+const lookOf = (r: GenerationRequest, m: ModelDef) => (m.options.looks && r.presetId ? lookCard(r.presetId) : undefined);
+
function swap(request: GenerationRequest, to: ModelDef, from: ModelDef): GenerationRequest {
if (to.id === from.id) return request;
const p = request.params ?? {};
// Keep what the new model takes; drop the old model's own settings.
const aspect = p.aspectRatio && (!to.options.aspectRatios || to.options.aspectRatios.includes(p.aspectRatio)) ? p.aspectRatio : to.defaults?.aspectRatio;
const resolution = p.resolution && to.options.resolutions?.includes(p.resolution) ? p.resolution : to.defaults?.resolution;
- return {
+ const out: GenerationRequest = {
...request,
modelId: to.id,
op: undefined,
params: { ...to.defaults, aspectRatio: aspect, resolution, numOutputs: p.numOutputs, seed: p.seed, enhancePrompt: p.enhancePrompt, palette: p.palette, extra: undefined },
};
+ // A Soul look is Fuobe Soul's own (its presetId): it doesn't go to a model that takes no looks.
+ if (from.options.looks && !to.options.looks) {
+ delete out.presetId;
+ delete out.presetStrength;
+ }
+ return out;
}
const setExtra = (r: GenerationRequest, key: string, value: unknown): GenerationRequest => ({ ...r, params: { ...r.params, extra: { ...r.params?.extra, [key]: value } } });
@@ -481,8 +490,11 @@ export function applySignature(req: GenerationRequest, sig: Signature | undefine
const move = (id: string, why: string) => {
const to = ctx.getModel(id);
if (!to || !model || to.id === model.id) return false;
+ const look = !to.options.looks ? lookOf(r, model) : undefined;
r = swap(r, to, model);
notes.push(why.replace("{model}", to.name));
+ // The moodboard's style wins over the look (it moved the run); say the look isn't used.
+ if (look && look.id !== DEFAULT_LOOK) notes.push(`The ${look.name} look is Fuobe Soul's own, so it isn't used on ${to.name}`);
model = to;
return true;
};
diff --git a/src/lib/catalog/plan.ts b/src/lib/catalog/plan.ts
index 4ea3f856..52510243 100644
--- a/src/lib/catalog/plan.ts
+++ b/src/lib/catalog/plan.ts
@@ -13,7 +13,7 @@ import type {
} from "./types";
import { chainGapProblem, chainTiming, FIRST_AT_ZERO, frameTimes, keyframeChain, MAX_KEYFRAMES, spread } from "./keyframes";
import { cloudPath, fitLoras, gated, localOnly, loraCapacity, needsToken, routeLoraField } from "./loras";
-import { soulKind, soulMegapixels, soulRecipe, soulSize, type SoulOverlay } from "./soul";
+import { CINEMA_CROP, soulKind, soulMegapixels, soulRecipe, soulSize, type SoulOverlay } from "./soul";
/** Infer the operation from what the user attached. */
export function inferOperation(model: ModelDef, req: Pick<GenerationRequest, "op" | "inputs" | "params">): Operation {
@@ -116,7 +116,7 @@ export interface Plan {
* expands them, the look stays), the look's LoRA triggers at the front (in order), and what happens after
* generation (the grade, an overlay) that the result's meta carries.
*/
- soul?: { look?: string; words: string; triggers: string[]; grade?: string; overlay?: SoulOverlay };
+ soul?: { look?: string; words: string; triggers: string[]; grade?: string; overlay?: SoulOverlay; crop?: "21:9" };
}
/** Operations that work from their inputs alone. */
@@ -301,6 +301,10 @@ export function planGeneration(
if (op === "bg-remove-video" && !params.matteOutput && matteOutputs && matteOutputs.length > 1) params = { ...params, matteOutput: matteOutputs[0] };
// Soul's prompt always carries the look's words: it's the user's own words a new picture needs.
if (soulPlan && op === "t2i" && !soulPlan.words) throw new Error("Write a prompt first");
+ // Soul HD (and Soul Cinema) make new pictures only: a picture attached isn't used, and the run says so.
+ if (soulPlan && op === "t2i" && req.inputs?.images?.length && !routesFor(model, "edit").length) {
+ notes.push(`${model.name} makes new pictures, so it doesn't use the picture you attached (Fuobe Soul restyles a picture with a look)`);
+ }
if (!prompt && !promptOptional(model, op) && !markedTarget(model, op, req, params)) {
throw new Error(op === "remove-object" ? "Say what to remove, e.g. “the coffee cup in her hand”" : "Write a prompt first");
}
@@ -310,6 +314,12 @@ export function planGeneration(
const presets = model.options.presets;
if (presets?.required && !params.extra?.[presets.param]) throw new Error(`Pick a ${presets.label.toLowerCase()} first`);
+ // Soul Cinema's 21:9 (research §4.5: a crop option): made at 16:9 on both engines, then cropped to 21:9 with
+ // its grade after generation (meta.crop).
+ if (soulPlan && soul === "cinema" && params.aspectRatio === CINEMA_CROP) {
+ params = { ...params, aspectRatio: "16:9" };
+ soulPlan = { ...soulPlan, crop: CINEMA_CROP };
+ }
// Soul's exact sizes on the user's GPU (the cloud routes send them through FieldMap.size); an edit keeps the
// picture's shape at the tier's size (about 1 or 2 megapixels).
if (soul && model.engine === "open" && op === "t2i") {
diff --git a/src/lib/catalog/soul.ts b/src/lib/catalog/soul.ts
index 3f2bf8ef..ea62d58f 100644
--- a/src/lib/catalog/soul.ts
+++ b/src/lib/catalog/soul.ts
@@ -110,6 +110,8 @@ export const needsCivitai = (look: Pick<SoulLook, "loras">): boolean => look.lor
export const SOUL_TIERS: SoulTier[] = ["720p", "1080p"];
/** The seven aspect ratios of Soul's size table. */
export const SOUL_ASPECTS: string[] = Object.keys(SOUL_SIZES["720p"]);
+/** Soul Cinema's crop option (research §4.5): made at 16:9, cropped to 21:9 after generation. */
+export const CINEMA_CROP = "21:9" as const;
/** Width and height for an aspect ratio and tier (the 720p tier and 3:4 when either is unknown). */
export function soulSize(aspectRatio: string | undefined, tier: string | undefined): { width: number; height: number } {
@@ -118,10 +120,16 @@ export function soulSize(aspectRatio: string | undefined, tier: string | undefin
return { width, height };
}
-/** Megapixels of one image at this size (what a per-megapixel price is billed on). */
+/**
+ * fal's megapixel is 1024 × 1024 pixels: its price pages bill a 1024x1024 image as one megapixel and a 1920x1080
+ * one as two. Soul's 720p tier is one (896x1152 is 0.98), its 1080p tier about two.
+ */
+export const FAL_MEGAPIXEL = 1024 * 1024;
+
+/** Megapixels of one image at this size, as a per-megapixel price bills them (fal's 1024 × 1024 megapixel). */
export const soulMegapixels = (aspectRatio: string | undefined, tier: string | undefined): number => {
const { width, height } = soulSize(aspectRatio, tier);
- return (width * height) / 1_000_000;
+ return (width * height) / FAL_MEGAPIXEL;
};
// ---------------------------------------------------------------------------
@@ -233,13 +241,18 @@ export function promptWithLoras(prompt: string, triggers: string[], kept: Pick<L
}
/**
- * What happens to a Soul result after generation, read from its request (the grade preset and the overlay the
- * browser applies; meta.grade / meta.overlay tell API clients). Undefined for other models.
+ * What happens to a Soul result after generation, read from its request (the grade preset, the overlay and Soul
+ * Cinema's 21:9 crop the browser applies; meta.grade / meta.overlay / meta.crop tell API clients). Undefined for
+ * other models.
*/
-export function soulPostSteps(modelId: string, presetId: string | null | undefined): { look?: string; grade?: string; overlay?: SoulOverlay } | undefined {
+export function soulPostSteps(
+ modelId: string,
+ presetId: string | null | undefined,
+ aspectRatio?: string | null,
+): { look?: string; grade?: string; overlay?: SoulOverlay; crop?: typeof CINEMA_CROP } | undefined {
const kind = soulKind(modelId);
if (!kind) return undefined;
- if (kind === "cinema") return { grade: SOUL_CINEMA.grades[0] };
+ if (kind === "cinema") return { grade: SOUL_CINEMA.grades[0], ...(aspectRatio === CINEMA_CROP && { crop: CINEMA_CROP }) };
const look = soulLook(presetId ?? DEFAULT_LOOK);
if (!look) return undefined;
return { look: look.id, ...(look.grade && { grade: look.grade }), ...(look.overlay && { overlay: look.overlay }) };
diff --git a/src/lib/soul-post.ts b/src/lib/soul-post.ts
index dd8f5efc..4c68f081 100644
--- a/src/lib/soul-post.ts
+++ b/src/lib/soul-post.ts
@@ -1,7 +1,7 @@
/**
- * Fuobe Soul's post steps (research §4.4), the part that runs in the browser when a result arrives: the look's
- * grade (src/lib/grade.ts presets, WebGL) and the text or frame some looks add, which diffusion draws badly
- * (a camera's date stamp, a CCTV caption, a photo-booth print). Pure: the layout of what to draw, and which
+ * Fuobe Soul's post steps (research §4.4), the part that runs in the browser when a result arrives: Soul Cinema's
+ * 21:9 crop (§4.5), the look's grade (src/lib/grade.ts presets, WebGL) and the text or frame some looks add, which
+ * diffusion draws badly (a camera's date stamp, a CCTV caption, a photo-booth print). Pure: the layout of what to draw, and which
* outputs still need it. src/components/studio/soul-finish.ts draws it; the server keeps the finished picture
* (POST /api/generations/<id>/finish) and the original beside it (meta.original).
*/
@@ -11,6 +11,8 @@ export type SoulOverlay = "date-stamp" | "cctv" | "photo-booth";
/** What an output asks for after generation (the server writes it as meta when the job succeeds). */
export interface FinishSteps {
+ /** Soul Cinema's 21:9: the 16:9 picture's middle band. */
+ crop?: "21:9";
grade?: string;
overlay?: SoulOverlay;
}
@@ -20,9 +22,23 @@ const OVERLAYS = new Set<SoulOverlay>(["date-stamp", "cctv", "photo-booth"]);
/** The steps one output still needs (none once it is finished, or for anything but an image). */
export function finishSteps(o: Pick<OutputFile, "kind" | "meta">): FinishSteps | null {
if (o.kind !== "image" || !o.meta || o.meta.finished) return null;
+ const crop = o.meta.crop === "21:9" ? ("21:9" as const) : undefined;
const grade = typeof o.meta.grade === "string" && o.meta.grade ? o.meta.grade : undefined;
const overlay = OVERLAYS.has(o.meta.overlay as SoulOverlay) ? (o.meta.overlay as SoulOverlay) : undefined;
- return grade || overlay ? { ...(grade && { grade }), ...(overlay && { overlay }) } : null;
+ return crop || grade || overlay ? { ...(crop && { crop }), ...(grade && { grade }), ...(overlay && { overlay }) } : null;
+}
+
+/** The crop of a `width` × `height` picture to an aspect ratio ("21:9"): the full width, the middle band (or the reverse). */
+export function cropRect(width: number, height: number, aspect: string): { x: number; y: number; width: number; height: number } {
+ const [a, b] = aspect.split(":").map(Number);
+ const want = a / b;
+ if (!(want > 0) || !(width > 0) || !(height > 0)) return { x: 0, y: 0, width, height };
+ if (width / height > want) {
+ const w = Math.round(height * want);
+ return { x: Math.round((width - w) / 2), y: 0, width: w, height };
+ }
+ const h = Math.round(width / want);
+ return { x: 0, y: Math.round((height - h) / 2), width, height: h };
}
/** Which outputs of a finished job still need their post steps (indexes into outputs). */
diff --git a/src/server/generations.ts b/src/server/generations.ts
index 69e87499..5f53aff7 100644
--- a/src/server/generations.ts
+++ b/src/server/generations.ts
@@ -450,9 +450,11 @@ function prepare(original: GenerationRequest) {
const { route, demo } = chooseRoute(routesFor(plan.model, plan.op), req.inputs?.images?.length ?? 0, plan.loras, seconds);
// What the cloud run can carry: a LoRA whose licence doesn't allow hosting stays on the GPU, and an API
// takes at most so many (the plan's notes say which were left out). Open runs carry them all. Without a
- // civitai key a civitai LoRA the run can't get is left out (and said), rather than failing at the download.
+ // civitai key a Soul look's civitai LoRA the run can't get is left out (and said), rather than failing at the
+ // download: the look's words still carry it. Any other run (a motion, whose LoRA is the point) still stops there.
const asked = plan.loras;
- const reachable = demo ? { loras: asked, notes: [] } : withoutUnreachableCivitai(asked, route.provider === "comfyui" ? "comfyui" : route.provider === "replicate" ? "replicate" : "fal");
+ const reachable =
+ demo || !plan.soul ? { loras: asked, notes: [] } : withoutUnreachableCivitai(asked, route.provider === "comfyui" ? "comfyui" : route.provider === "replicate" ? "replicate" : "fal");
const fitted = fitLoras(reachable.loras, route);
// A Soul look's triggers lead the prompt: a LoRA left out takes its trigger with it.
const prompt = plan.soul ? promptWithLoras(plan.prompt, plan.soul.triggers, fitted.loras) : plan.prompt;
@@ -467,8 +469,9 @@ function prepare(original: GenerationRequest) {
const span = f.min !== undefined && f.max !== undefined ? ` makes ${half(f.min / fps)}–${half(f.max / fps)} s clips,` : "";
notes.push(`${plan.model.name} on ${provider(route.provider).label}${span} so this one is about ${half(made)} s, not ${seconds} s`);
}
- // A route that can't batch (Higgsfield's Grok Imagine Image beside fal's num_images) runs one job per output.
- if (!demo && route.map && !route.map.numOutputs && plan.perJobOutputs > 1) {
+ // A route that can't batch (Higgsfield's Grok Imagine Image beside fal's num_images; a ComfyUI graph, which makes
+ // one picture a run: Fuobe Soul on the open engine) runs one job per output.
+ if (!demo && !route.map?.numOutputs && plan.perJobOutputs > 1) {
plan = { ...plan, jobs: plan.jobs * plan.perJobOutputs, perJobOutputs: 1, params: { ...plan.params, numOutputs: 1 } };
}
const providerId: ProviderId = demo ? "mock" : route.provider;
@@ -1089,8 +1092,9 @@ async function pollOne(r: Row): Promise<void> {
console.warn(`[fuobe] could not save output for ${r.id}: ${(e as Error).message}`);
}
}
- // Fuobe Soul: what follows in the browser (the look's grade, an overlay), on each image; API clients read it as meta.
- const post = soulPostSteps(r.model_id, r.preset_id);
+ // Fuobe Soul: what follows in the browser (the look's grade, an overlay, Soul Cinema's 21:9 crop), on each image;
+ // API clients read it as meta.
+ const post = soulPostSteps(r.model_id, r.preset_id, soulKind(r.model_id) ? requestAspect(r.request_json) : undefined);
if (post) for (const [i, o] of outputs.entries()) if (o.kind === "image") outputs[i] = { ...o, meta: { ...o.meta, ...post } };
update(r.id, {
status: "succeeded",
@@ -1197,6 +1201,15 @@ export async function cancelGeneration(id: string): Promise<void> {
// ---------------------------------------------------------------------------
// Fuobe Soul's post steps (the look's grade and overlay), made in the browser when the result arrives.
+/** The aspect ratio a stored request asked for (Soul Cinema's 21:9 is made at 16:9 and cropped). */
+function requestAspect(json: string): string | undefined {
+ try {
+ return (JSON.parse(json) as GenerationRequest).params?.aspectRatio;
+ } catch {
+ return undefined;
+ }
+}
+
export class FinishError extends Error {
constructor(
message: string,
diff --git a/src/server/loras.ts b/src/server/loras.ts
index 7d63c3d3..5fa4906a 100644
--- a/src/server/loras.ts
+++ b/src/server/loras.ts
@@ -425,12 +425,14 @@ export function filesInLoraFolder(): { files: Set<string>; problem?: string } {
}
/**
- * Before a run, without a civitai key: the civitai LoRAs it can't get, so the run goes ahead without them (the
- * look's words still carry it) and says how to add them, instead of failing at the download. A LoRA is still
- * reachable when ComfyUI's LoRA folder already has it (open engine) or a live mirror exists (cloud).
+ * Before a Fuobe Soul run, without a civitai key: the civitai LoRAs it can't get, so the run goes ahead without
+ * them (the look's words still carry it) and says how to add them, instead of failing at the download. A LoRA is
+ * still reachable when ComfyUI's LoRA folder already has it (open engine) or a live mirror exists (cloud). A
+ * local-only LoRA (civitai's RentCivit-only licence) counts on the open engine; a cloud run never carries it
+ * (fitLoras leaves it out and says so).
*/
export function withoutUnreachableCivitai(loras: LoraRef[], target: MirrorTarget): { loras: LoraRef[]; notes: string[] } {
- const civitai = loras.filter((l) => !l.hostedUrl && needsToken(l.url) && !localOnly(l));
+ const civitai = loras.filter((l) => !l.hostedUrl && needsToken(l.url) && (target === "comfyui" || !localOnly(l)));
if (!civitai.length || civitaiKey()) return { loras, notes: [] };
const folder = target === "comfyui" && getSetting("comfyLorasDir") ? filesInLoraFolder().files : null;
const unreachable = civitai.filter((l) => {
diff --git a/tests/soul-originals.test.ts b/tests/soul-originals.test.ts
index 88c86064..77f099b8 100644
--- a/tests/soul-originals.test.ts
+++ b/tests/soul-originals.test.ts
@@ -105,7 +105,8 @@ describe("Soul looks (soul-originals.generated.ts)", () => {
expect(soulSize("16:9", "1080p")).toEqual({ width: 1920, height: 1088 });
expect(soulSize("9:16", "720p")).toEqual({ width: 768, height: 1344 });
expect(soulSize(undefined, undefined)).toEqual({ width: 896, height: 1152 });
- expect(soulMegapixels("1:1", "720p")).toBeCloseTo(1.048576);
+ // fal bills a 1024x1024 image as one megapixel (1024 × 1024 pixels).
+ expect(soulMegapixels("1:1", "720p")).toBe(1);
expect(SOUL_SAMPLER).toEqual({ steps: 8, cfg: 1, sampler: "res_multistep", scheduler: "simple", shift: 3 });
});
});
diff --git a/tests/soul-runs.test.ts b/tests/soul-runs.test.ts
index 16778945..65754d21 100644
--- a/tests/soul-runs.test.ts
+++ b/tests/soul-runs.test.ts
@@ -131,10 +131,10 @@ describe("Fuobe Soul on both engines", () => {
it("prices per megapixel of every image: free on the GPU, the /lora price with LoRAs, whole megapixels on Soul HD", () => {
const cloud = onEngine(soul(), "cloud");
const p = plan("cloud", { params: { aspectRatio: "1:1", resolution: "720p", numOutputs: 4 } });
- expect(estimateCost(cloud, p.params, p.jobs, p.op, true)).toBeCloseTo(0.0085 * 1.048576 * 4, 3);
+ expect(estimateCost(cloud, p.params, p.jobs, p.op, true)).toBeCloseTo(0.0085 * 4, 4);
expect(estimateCost(onEngine(soul(), "open"), p.params, p.jobs, p.op)).toBe(0);
const hd = onEngine(getModel("fuobe-soul-hd")!, "cloud");
- expect(estimateCost(hd, { aspectRatio: "16:9", resolution: "1080p", numOutputs: 1 }, 1, "t2i")).toBeCloseTo(0.02 * 3, 3);
+ expect(estimateCost(hd, { aspectRatio: "16:9", resolution: "1080p", numOutputs: 1 }, 1, "t2i")).toBeCloseTo(0.02 * 2, 3);
});
it("gives Soul Cinema its film look and Soul HD the look's words without Z-Image LoRAs", () => {