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.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
N7-6: the turnaround eval suite and /api/turnaround/estimate
Claudea7980a0c486b
diff --git a/scripts/eval/README.md b/scripts/eval/README.mdindex 3ba0784e..1150a1ab 100644--- a/scripts/eval/README.md+++ b/scripts/eval/README.md@@ -122,6 +122,7 @@ One JSON file per Original in `cases/`. Later Original packages add their own fi| `speak` | talking portraits | 1 portrait + voice | `infinitetalk`, `s2v` | lipsync, temporal, identity || `cinema` | Fuobe Cinema (O6) | 3 Director scenes (the prompt Cinema compiles), 4 camera moves as LTX-2.3's `camera_lora` (cloud), 2 films of 3 shots | `original`, `words` (no camera LoRA), `expansion` (fal's prompt expansion on), `wan` (Wan 2.2 A14B hosted), `partner` (Seedance 2.5); all but `original` cloud only | clip, temporal, continuity || `marketing` | Fuobe Marketing Image, Fuobe Try-On, the AI Influencer sheet and Instadump (O10) | 7: a Standalone product shot (the product-shot graph on your GPU; hosted Qwen-Image-Edit in the cloud), an ad's picture, a poster without a product, a try-on, the builder's sheet (through `/api/influencer`), an Instadump photo from a selfie | `original`, `partner` (cloud: GPT Image 2.5, Nano Banana Pro, Ideogram 3.0, FASHN) | clip, aesthetic, style (the product), identity (try-on, Instadump) |+| `turnaround` | Turnaround video (N7-6) | 4 through `/api/turnaround`: four views, the front and the back (sides drawn by the Angles app), the front alone, a sheet alone (a front drawn from it) | `default` (Frames on your GPU, H3 Max references in the cloud), `keyframes` (cloud: FLUX 3 Max), `camera` (cloud: H3 Max camera controls) | identity of 8 sampled frames against the views, temporal, clip |`soul.json`, `soul-cinema.json`, `soul-hex.json`, `dop.json` and `dop-mix.json` are **generated** from the research. They come from`docs/research/higgsfield-image-studios.json` (the look ids) anddiff --git a/scripts/eval/cases/turnaround.json b/scripts/eval/cases/turnaround.jsonnew file mode 100644index 00000000..08132077--- /dev/null+++ b/scripts/eval/cases/turnaround.json@@ -0,0 +1,116 @@+{+ "$schema": "./case.schema.json",+ "suite": "turnaround",+ "title": "Turnaround video · a cast sheet or a character filmed all the way round",+ "description": "Build plan N7-6 (new-models-7.md §3.7 recipes B and C): POST /api/turnaround, priced by /api/turnaround/estimate, on your pictures of one consenting person or a made-up character in local/turnaround/: front.png, right.png, back.png and left.png (their own right and left: facing them, their right side is on your left; full body, a plain background) and sheet.png (a turnaround sheet of the same character). The open engine films the views as Frames mode's Wan 2.2 14B start/end-frame chain, the sides it has no picture of drawn first by the Angles app's open route; the cloud takes them as MiniMax H3 Max references (Image 1…n), FLUX 3 Max keyframes, or, from the front alone, an H3 Max camera-controls orbit. Identity is ArcFace-style face similarity (AuraFace, or --identity-model buffalo_l) of 8 frames sampled from the film against the person's views; about half the frames show the back, so the face rate is expected near 0.5. A GPU or key run picks the default route per engine from this suite: identity first, then temporal steadiness and prompt match. The words are Fuobe's own.",+ "original": "fuobe-turnaround",+ "kind": "video",+ "targets": {+ "open": { "models": ["oss-wan22-14b"] },+ "cloud": { "models": ["minimax-h3-max"] },+ "demo": { "models": ["oss-wan22-14b"] }+ },+ "defaults": { "seeds": [1001], "metrics": ["identity", "temporal", "clip"], "timeoutSeconds": 3600, "candidate": "default" },+ "variants": {+ "default": {+ "description": "Each engine's default route: Frames (Wan 2.2 14B) on your GPU, H3 Max reference-to-video in the cloud"+ },+ "keyframes": {+ "description": "FLUX 3 Max keyframes-to-video: each view at its quarter of the turn (cloud)",+ "engines": ["cloud"],+ "models": { "cloud": ["flux-3-max"] }+ },+ "camera": {+ "description": "H3 Max camera controls: an exact clockwise orbit from the front view alone, the sides and back invented (cloud)",+ "engines": ["cloud"],+ "models": { "cloud": ["minimax-h3-max-camera"] }+ }+ },+ "cases": [+ {+ "id": "turnaround/four-views",+ "title": "Four views of the person: front, right side, back, left side",+ "inputs": { "images": ["local/turnaround/front.png", "local/turnaround/right.png", "local/turnaround/back.png", "local/turnaround/left.png"] },+ "demoInputs": { "images": ["fixtures/character/drawn-face-1.png", "fixtures/character/drawn-face-2.png", "fixtures/start-frame.png", "fixtures/character/drawn-face-3.png"] },+ "prompts": [{ "id": "orbit", "text": "The camera orbits 360 degrees around the person at a constant height; the person stands naturally" }],+ "references": ["local/turnaround/front.png", "local/turnaround/right.png", "local/turnaround/left.png"],+ "submit": {+ "route": "/api/turnaround",+ "estimate": "/api/turnaround/estimate",+ "body": {+ "engine": "{{engine}}",+ "modelId": "{{modelId}}",+ "views": { "front": "{{inputs.images.0}}", "right": "{{inputs.images.1}}", "back": "{{inputs.images.2}}", "left": "{{inputs.images.3}}" },+ "seed": "{{seed}}",+ "realPerson": true,+ "consent": true,+ "requestId": "{{requestId}}"+ }+ }+ },+ {+ "id": "turnaround/front-and-back",+ "title": "The front and the back: the sides drawn first by the Angles app",+ "inputs": { "images": ["local/turnaround/front.png", "local/turnaround/back.png"] },+ "demoInputs": { "images": ["fixtures/character/drawn-face-1.png", "fixtures/start-frame.png"] },+ "prompts": [{ "id": "orbit", "text": "The camera orbits 360 degrees around the person at a constant height; the person stands naturally" }],+ "references": ["local/turnaround/front.png", "local/turnaround/right.png", "local/turnaround/left.png"],+ "submit": {+ "route": "/api/turnaround",+ "estimate": "/api/turnaround/estimate",+ "body": {+ "engine": "{{engine}}",+ "modelId": "{{modelId}}",+ "views": { "front": "{{inputs.images.0}}", "back": "{{inputs.images.1}}" },+ "fill": true,+ "seed": "{{seed}}",+ "realPerson": true,+ "consent": true,+ "requestId": "{{requestId}}"+ }+ }+ },+ {+ "id": "turnaround/front-only",+ "title": "One front view: every other side drawn first (the camera variant films it alone)",+ "inputs": { "images": ["local/turnaround/front.png"] },+ "demoInputs": { "images": ["fixtures/character/drawn-face-1.png"] },+ "prompts": [{ "id": "orbit", "text": "The camera orbits 360 degrees around the person at a constant height; the person stands naturally" }],+ "references": ["local/turnaround/front.png", "local/turnaround/right.png", "local/turnaround/left.png"],+ "submit": {+ "route": "/api/turnaround",+ "estimate": "/api/turnaround/estimate",+ "body": {+ "engine": "{{engine}}",+ "modelId": "{{modelId}}",+ "views": { "front": "{{inputs.images.0}}" },+ "fill": true,+ "seed": "{{seed}}",+ "realPerson": true,+ "consent": true,+ "requestId": "{{requestId}}"+ }+ }+ },+ {+ "id": "turnaround/sheet",+ "title": "A turnaround sheet only: a front view drawn from it first",+ "inputs": { "images": ["local/turnaround/sheet.png"] },+ "demoInputs": { "images": ["fixtures/references/warm-1.png"] },+ "prompts": [{ "id": "orbit", "text": "The camera orbits 360 degrees around the person at a constant height; the person stands naturally" }],+ "references": ["local/turnaround/front.png", "local/turnaround/right.png", "local/turnaround/left.png"],+ "engines": ["demo", "open", "cloud"],+ "submit": {+ "route": "/api/turnaround",+ "estimate": "/api/turnaround/estimate",+ "body": {+ "engine": "{{engine}}",+ "modelId": "{{modelId}}",+ "sheet": "{{inputs.images.0}}",+ "seed": "{{seed}}",+ "requestId": "{{requestId}}"+ }+ }+ }+ ]+}diff --git a/src/app/api/turnaround/estimate/route.ts b/src/app/api/turnaround/estimate/route.tsnew file mode 100644index 00000000..aab9869a--- /dev/null+++ b/src/app/api/turnaround/estimate/route.ts@@ -0,0 +1,17 @@+import { recordExists } from "@/server/records";+import { body, handle } from "@/server/shorts-schemas";+import { previewTurnaround, TurnaroundBodySchema, turnaroundRun } from "@/server/turnaround";++/**+ * A turnaround's price and plan, as the studio routes' estimates answer it (the evaluation harness prices a job here+ * before running it): the model the film runs on, what it costs, whether it would be a demo, the notes.+ */+export async function POST(request: Request) {+ return handle(async () => {+ const input = await body(request, TurnaroundBodySchema, "Pick the engine and the character's pictures");+ delete input.requestId;+ if (input.elementId && !recordExists({ kind: "element", ids: [input.elementId] })) return Response.json({ error: "Character not found" }, { status: 404 });+ const p = previewTurnaround(turnaroundRun(input));+ return Response.json({ ...p, modelId: p.model.id, modelName: p.model.name });+ });+}diff --git a/src/app/api/turnaround/route.ts b/src/app/api/turnaround/route.tsindex 02863f14..ba18c5ce 100644--- a/src/app/api/turnaround/route.ts+++ b/src/app/api/turnaround/route.ts@@ -1,14 +1,6 @@-import { z } from "zod";import { recordExists } from "@/server/records";import { body, handle, once } from "@/server/shorts-schemas";-import { createTurnaround, previewTurnaround, TurnaroundSchema } from "@/server/turnaround";--const Body = TurnaroundSchema.extend({- /** Made from a character's page: the film goes into that character's feed. */- elementId: z.string().max(40).optional(),- /** A repeated requestId (a second click) gets the run the first one started. */- requestId: z.string().max(80).optional(),-});+import { createTurnaround, previewTurnaround, TurnaroundBodySchema, turnaroundRun } from "@/server/turnaround";/*** Turnaround video (build plan N7-6): a 360° turnaround of a cast sheet or a character, on either engine. `?preview=1` plans@@ -16,9 +8,9 @@ const Body = TurnaroundSchema.extend({*/export async function POST(request: Request) {return handle(async () => {- const { elementId, requestId, ...input } = await body(request, Body, "Pick the engine and the character's pictures");- if (elementId && !recordExists({ kind: "element", ids: [elementId] })) return Response.json({ error: "Character not found" }, { status: 404 });- const run = { ...input, ...(elementId && { feature: `element:${elementId}` }) };+ const { requestId, ...input } = await body(request, TurnaroundBodySchema, "Pick the engine and the character's pictures");+ if (input.elementId && !recordExists({ kind: "element", ids: [input.elementId] })) return Response.json({ error: "Character not found" }, { status: 404 });+ const run = turnaroundRun(input);if (new URL(request.url).searchParams.get("preview")) return Response.json(previewTurnaround(run));const result = await once("turnaround", requestId, () => createTurnaround(run));return Response.json(result, { status: 201 });diff --git a/src/lib/catalog/turnaround.ts b/src/lib/catalog/turnaround.tsindex 71734265..3b7cbe31 100644--- a/src/lib/catalog/turnaround.ts+++ b/src/lib/catalog/turnaround.ts@@ -337,6 +337,11 @@ export function defaultRoute(engine: Engine, input: Pick<TurnaroundInput, "viewsreturn routes.includes(want) ? want : (routes[0] ?? want);}+/** The route a model runs on this engine (an API client or the evaluation harness names the model, not the route). */+export function routeOfModel(engine: Engine, modelId: string | undefined): TurnRoute | undefined {+ return ROUTES_ON[engine].find((r) => TURN_ROUTES[r].modelId === modelId);+}+/** The duration a route takes: the one asked for when offered, else the nearest it offers. */export function turnDuration(route: TurnRoute, asked?: number): number {const { durations, duration } = TURN_ROUTES[route];diff --git a/src/server/turnaround.ts b/src/server/turnaround.tsindex 6e4deefb..c443a7b3 100644--- a/src/server/turnaround.ts+++ b/src/server/turnaround.ts@@ -3,7 +3,7 @@ import { nanoid } from "nanoid";import { z } from "zod";import { getModel } from "@/lib/catalog";import { routesFor } from "@/lib/catalog/plan";-import { planTurnaround, type TurnaroundContext, type TurnaroundInput, type TurnaroundPlan, type TurnaroundPreview, type TurnStep } from "@/lib/catalog/turnaround";+import { planTurnaround, routeOfModel, type TurnaroundContext, type TurnaroundInput, type TurnaroundPlan, type TurnaroundPreview, type TurnStep } from "@/lib/catalog/turnaround";import type { Generation } from "@/lib/catalog/types";import { cancelGeneration, createGenerations, previewChained, previewGeneration } from "./generations";import { isOffered } from "./model-access";@@ -34,6 +34,22 @@ export const TurnaroundSchema = z.object({consent: z.boolean().optional(),});+/** What /api/turnaround and its estimate take: the turnaround, the character it's for, the model named instead of a route. */+export const TurnaroundBodySchema = TurnaroundSchema.extend({+ /** Made from a character's page: the film goes into that character's feed. */+ elementId: z.string().max(40).optional(),+ /** The model to film it with (the evaluation harness names models): its route, when this engine has one for it. */+ modelId: z.string().max(80).optional(),+ /** A repeated requestId (a second click) gets the run the first one started. */+ requestId: z.string().max(80).optional(),+});++/** A request body as the server runs it: a character's run filed in its feed, a named model's route. */+export function turnaroundRun({ elementId, modelId, ...input }: Omit<z.infer<typeof TurnaroundBodySchema>, "requestId">): TurnaroundRequest {+ const route = input.route ?? routeOfModel(input.engine, modelId);+ return { ...input, ...(route && { route }), ...(elementId && { feature: `element:${elementId}` }) };+}+export class TurnaroundError extends Error {constructor(message: string,