Spaces:
Running
Running
Commit History
-
Add an Avatar swap page that puts a library avatar into any uploaded video, in segments, keeping its sound
MiniMax H3 Max Recast on fal replaces the person in existing footage while keeping motion, camera, timing and soundtrack. Videos over 15s go up as 15s segments with one seed and are stitched back; the source audio is laid over the result. The editor's Clip tab gets the same swap for one clip. The reference upload gains a keep_audio option because it stripped sound before the swap could see it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>36c7c8a
-
Make the shot list follow a chat-rewritten script, and refresh it without a re-score click
A chat note rewrote the script but the scenes kept the old lines, and the render speaks the scenes. A shot list that doesn't say the new words is now dropped so the resync re-derives it, and the detail page follows that resync job so the scenes refresh on their own. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>ff6fb00
-
Reuse the b-roll and hooks we already own, keep the avatar's face on every clip, render in HD, remember products, and let the chat rewrite the script
B-roll library: a cutaway without a prop frame or the ad's own person first searches the catalogued hooks_video clips (vector match, then a flash judge on subject and action), and the Drive copy is cut, muted and cropped to 9:16; the hook agent may open the ad on a catalogue clip (hook_clip_id) with the spoken hook as TTS voiceover, and in continuous mode the rest of the ad inherits that voice. Reused clips are reported as library_clips. BROLL_LIBRARY toggles it. Avatar drift: the library avatar's portrait and voice sample now go to Seedance on every presenter clip, not only the first (the ecom Genie render had a different woman three hops on). A refused portrait stops the render instead of quietly rendering a stranger. `recovered` and `library_clips` are stored on the renders row (migration 0013). Resolution: the plan carries 480p or 720p, chosen in the render UI; the editor reads a stored clip's size back so edits keep the render's quality. HD is priced at fal's 720p rate in both e…6b440a2
-
Ask one question at a time, show the wait, let the brief lead, and keep refusals, faces and voices in hand
New generation form is a stepper with a review page. Running jobs show the usual time left, learned from finished renders. A brief the requester typed outranks the brain's patterns. A reference can be matched closely (same setting, cast and shots), the reader records cast and setting, more than one person may speak, and a chosen avatar is the main character with their look read from the portrait. fal moderation refusals were misread as transient when the echoed prompt contained a word like "internal": status decides now, so the chain-refusal ladder sees them. Gemini calls time out instead of freezing a run. One QA rewrite per candidate, two candidates for long ads, one critic re-render, four worker slots on the Space. Picture-chained clips carry the ad's voice as a reference, so it no longer drifts to another speaker. Realism prompts say what phone footage looks like instead of listing what to avoid. Styled cards pick a band clear of the face, and the selfie band stays clear when no …af66f2f
-
Cast real people with their own voices, sell the product you attached, and take five-minute ads
Avatar library: 250 presenters imported from reference creators, each with a MiniMax voice cloned from their own sample (scripts/clone_voices.py), so the classic, green-screen and split modes speak in the avatar's voice instead of a stock one. Library frames are cropped to 9:16 on load and voice samples trimmed to what Seedance accepts, and the stitch now scales and crops every clip to the exact frame, which is what let the first avatar render through. Product briefs: an Ecom niche whose ads are always for one product (the API refuses one without), product pages read into facts and photos, and a brief that carries a product is researched from the product rather than the niche. The form no longer carries a prefilled brief from one niche into another. Limits: reference ads and generated ads up to five minutes. Long videos go to Gemini through its file store and are deleted the moment the read is done. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>7dfe8d4
-
Stop paying twice, measure every run, and make the picture, voice and props hold up
Spend and reliability: identical paid requests reuse the running job, every paid button shows a price and asks first, uploads no longer block the server, job status comes from the database, and the synchronous video endpoint is gone. Measurement: every model call logs tokens and cost, generations and renders carry a cost, and an eval runner replays saved briefs without touching the DB. Platform: vector search over the whole library (pgvector HNSW), one image that runs as api, worker or both, persistent Redis, TLS for external Redis, and a production guard that refuses local media. Scripts and judging: a hard spoken-word budget, no fragment sentences in continuous mode, a fixed Gemini judge on every run, ad-policy checks, and hooks drawn from the brain or the research with no opener steering. Video: a render critic that reviews every clip and re-renders the bad ones, takes planned to land within 10% of target, portraits checked before any paid animation (no more grid presenters), th…13354e2
-
Add green-screen and split-screen modes, reference-ad generation, researched briefs, and a voice that sits in the picture
Video modes, chosen on the New Generation form (default = the old flow): - greenscreen: one lip-synced presenter (OmniHuman) matted out with veed background removal and laid small in a corner over b-roll, hopping corners every few seconds; every scene is a silent cutaway behind them - split: the same pipeline stacked top/bottom, flipping each take; cards, CTA pill and stamps follow the flip - TTS is chunked into takes under OmniHuman's 30s cap and checked before any clip is paid for; a failed presenter take fails the render instead of shipping b-roll alone; raw takes are kept beside the clips Reference-ad mode: upload an existing 10-90s ad, Gemini reads its structure (hook type, beats, pacing, format, tone) in two passes so no market words survive, and the reading is pinned as the chosen concept. Brief is optional: blank (or a placeholder like "make like the reference") is filled by live niche research before any agent runs and logged as brief_derived; the form prefills fro…02862d5
-
Burn in social-native overlays, feed human notes back, and give the camera a real hand
- Overlay engine: 21 TikTok/CapCut/iOS/Snapchat templates vendored from ArielleTolome/overlay-text-video-editor (MIT) and rendered in headless Chromium via Playwright (app/services/overlay_styles.py). Our Pillow renderer is the fallback for every one of them, so a Space without a browser still ships a finished ad. GSAP is vendored: the templates expect the host to provide it and drew nothing without it. Their caption substitution replaced a sentinel inside the scripts too and fell back to demo text; we substitute in markup only. The notification storm and stack templates were hardcoded demos; they now take our notifications. - Captions default to the CapCut bounce style (bold, keyword highlight) with a pop-in animation; the editor gets a Caption style control. Karaoke stays as our own renderer and as the fallback. Styled frames are trimmed to their content so they can be animated about their own centre. - The director's on_screen_text, never rendered before, is bu…e0d867f
-
Tell a slow render from a stuck one
The tray declared a healthy render dead at clip 7 of 8. The server and the client disagreed on what "lost" means: jobs.py ages a job from `updated_at`, so every tick resets the clock and it measures staleness; the client compared `now - startedAt`, which is total runtime, and then printed "no progress for 45 min" — a thing it never measured. Being slower than the threshold is not the same as being stuck, and the client's guess overruled a server that was correctly reporting the job as running. It matters now because continuous mode generates clips serially and the prompt budget split raised the clip count: a five-clip render took 40 minutes, an eight-clip one takes fifty. Every render was about to be declared dead. Jobs now carry `progressedAt`, re-stamped only when progress or stage actually moves, and prune ages from that. The message names the stage it stalled at rather than asserting a duration nothing checked. fromServer took its timestamp from Date.now() directly, so none of t…a089b83 -
Never plan a prompt the video model will reject
Packing several scenes into one generation made prompts far longer: the production style and style anchor alone are ~1.8k characters before a single shot is described, and each labelled shot adds its action, setting, lighting and line on top. A wordy shot list therefore produced 5279-character prompts against a 4000 limit — and since the plan is rebuilt deterministically from the shot list, pressing "Plan video" again returned the identical rejected prompt. Prompt edits in the panel are local, so the only escape was rewriting the shot list. Grouping counts scenes and seconds; neither predicts prompt length. So the plan now compiles each group and splits any that would not fit. Wordy shot lists get fewer shots per clip, which is the honest trade — a plan that cannot render is worse than one more clip. The panel also hid the prompt editor unless the stage was exactly "reviewing", so a failed render left an error and a "Plan video" button and no way to reach the clip that failed. It sho…35fe988 -
Cut at an ad's pace, and check every edit instead of waiting to be asked
Continuous mode rendered one Seedance call per scene, so every scene inherited the model's 4s minimum CLIP length. A 2s cutaway was unrenderable and 13 shots forced a 52s floor onto a 44s ad — the pipeline could not make the ad it was asked for, and the padding played as dead air. Scenes now share a generation as labelled, timestamped shots with hard cuts between them, which is what Seedance 2.5 does natively and what the muxed path already relied on. Three calls where there were thirteen: cheaper, faster (this mode renders serially), and fewer chained clips means less presenter drift. Delivery was conversational at 146 wpm. The only speed lever in this mode is the prompt, and it said "unhurried, do not rush" — while the script agent wrote to a stale 2.2 words/second the pipeline had long since left behind, so every script came in a third short of its runtime. Both now read the same measured number. The chain reference was the whole previous clip. Seedance continues from where it END…2ce71df
-
updated gitignore
68eb821
-
Make the product legible: scorecard, progress, compare strip, auto b-roll
Organised around the user's three decisions — which candidate to render, whether a render is worth spend, and did it win — instead of around how the pipeline works. Render scorecard - Every render is measured with ffmpeg as it saves (dead-air %, cut count, avg/longest shot, duration vs target) into renders.scorecard (0005), shown as banded chips on the render card. Every defect caught this month was found by measuring the file by hand after it already felt wrong; now the numbers arrive with the render. Edited exports are measured too. Renders report progress — and "lost" means lost - The progress pipeline existed end to end and the longest job in the product never used it: run_render made no ticks, so the tray's 45-quiet-minutes rule declared a live 21-clip render lost and told the user "no result" while it was still spending money. Ticks per clip now bump the row, so lost genuinely means nothing moved for 45 minutes, and the lost message says what that implies (a c…1030636 -
Ground cutaways in the real library, score every variant, filter by date, retry a failed run
B-roll grounded in catalogued footage - The second-pass cutaway call was passing evidence=None, so it wrote shots from imagination while 900+ catalogued clips sat unused. It now receives the library and is told to find the clip whose visual_description fits the line and describe THAT shot — its framing, motion, mood, subjects, and its visual_direction where present. Those clips were really filmed, so recreating one lands closer to real footage than anything invented. Variants are finished, not sketches - QA judges a script AGAINST its shot list, so a bare script cannot be scored. Each variant now gets its own visual direction, b-roll plan and QA verdict, and the list is sorted best-first — you pick by number rather than by feel. Three calls a variant, on a button you pressed. - Adopting one now re-derives the shot list and re-scores, exactly as saving a hand edit does. Without that an adopted variant kept the previous candidate's shots and a score describing a scri…7dc13d4
-
Script variations on demand, and apply the winner's own QA notes
Script variations - "Write 3 variations" next to the script: same hook, same claims, same beats, different delivery. The counterpart to the QA fix button, which repairs something broken — this one assumes the script is GOOD and asks what else could be said, which is the variable worth testing when the offer is fixed. - Variants are drafts. They are logged, not attached: an unapplied variant on the candidate would make "what is this ad" ambiguous. Adopting one goes through the normal edit path, so the script it replaces is saved and the shot list is re-derived exactly as a hand edit would do. - Runs as a Celery job (one Gemini call per variant) and reports through the existing tray rather than blocking the request. Winner polish - The revision loop is `while not qa.passed`, so a PASSING candidate is never revised and its own QA notes are recorded and dropped. A shipped ad said "protected their household cashflow" — the exact brochure phrasing QA flagged — with the r…28e4e84
-
Ground generation in the real schema, and tune pace against reference ads
Two reference ads were torn down shot by shot and measured. Ours ran 4.4s average shots with 15% dead air; they ran 2.6-3.7s with 0-11%. Everything here follows from closing that gap and from writing the database schema down next to the code that reads it. Pace and dead air - Only the last VOICED clip holds a beat now. SPEECH_TAIL_SECONDS was paid on every clip, which put ~0.7s of silence on each cut: 7.4s of a 48s ad. - presenter_max_seconds (6s), separate from the model's 15s per-clip ceiling. The two were the same value, which is exactly why the longest shot measured 15.0s — the model's limit standing in for an editor's. - split_overlong_scenes cuts a long monologue into several shots. Moving surplus words to a neighbour cannot converge: the last scene has no forward neighbour, so it pushes them back and the pass ping-pongs. Latent at a 15s cap, guaranteed at 6s. Replay of the shipped ad: 11 shots -> 14, avg 4.27s -> 3.36s, longest 15.0s -> 5.1s. The hook decides its…6272eef
-
Move every hosted model to fal.ai, and cast the narrator to the presenter
Replaces Replicate entirely, upgrades Seedance 2.0 -> 2.5 at 480p, and swaps Gemini TTS for ElevenLabs v3. Also lands the brain tables, the concept picker, and the QA/version work — they share too many files to separate without leaving intermediate commits that don't run. Provider migration - app/services/fal.py is the single door: upload (fal takes URLs, not file handles), run (subscribe owns the queue, so the create/poll/reload loops are gone) and guard, which preserves the failure taxonomy that matters — a moderation refusal must stay distinguishable from a 503 or we either burn retries on a request that can never succeed, or lose a render to a blip. SeedanceError is renamed ProviderError now that it covers speech. - Seedance 2.5 splits into per-mode endpoints and text-to-video accepts NO reference input, so the endpoint is chosen by whether a reference was passed. Live testing caught a 422 on top of that: 2.5 rejects an explicit aspect_ratio on a video extension, s…07f3ede -
Make the tabs, disclosures and controls reachable by keyboard
Measured the palette first: it is in good shape (chalk 14.6:1 on slate, gaffer 8.5, viewfinder 6.8), and focus rings, reduced-motion and press feedback were already there. What was missing was structural. - The three view tabs were plain buttons: nothing announced them as a set, nothing said which was selected, and Tab walked through all three before reaching the panel. Now a real ARIA tablist with roving tabindex, so the strip is ONE tab stop and left/right moves between tabs. - Disclosure buttons carried no aria-expanded — the +/- glyph was the only state signal, invisible to a screen reader. The glyphs are aria-hidden now that the button announces itself. - No landmarks at all, so assistive tech had no way to skip the header into the content. Added <main> and a skip link. - The editor's 3x3 position grid conveyed the selected cell by fill colour alone; it now carries aria-pressed and a real label per cell. - A 32px min-height floor on buttons: the compact uppercase la…19955ca
-
Re-score after a visual-direction edit too, not only a script edit
Only a script change triggered a re-score, so editing the shot list by hand — or through the chat — left `final_score` describing a plan that was no longer there. The score is the one number a user trusts to compare candidates, so a stale one is worse than no number. `resync_visuals=false` already existed for exactly this and was never called: - Saving the form now re-scores when EITHER the script or the shot list changed, and re-derives the shot list only when the script did. A hand-edited shot list is re-scored without being regenerated, which would have thrown the edit away. - The chat panel gets an explicit "Re-score" button rather than doing it per turn. Notes arrive in bursts, and a QA call per message would both cost more and leave the grade jittering while you are still deciding. The header says plainly that the grade is stale until you press it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>6236afc -
Add a chat surface for the visual direction
Editing a shot list through form fields means knowing which of thirteen fields to change on which of six scenes. "Make scene 3 a close-up of hands, and lose the kitchen" is how a person actually gives that note. One Gemini call per turn, synchronous — a chat that takes a minute to answer isn't a chat. The reply and the revised shot list come back together. The distinction that makes it trustworthy: a QUESTION is answered with `visual_direction: null` and nothing is written. Only an instruction rewrites the plan, and it returns the complete shot list with `changed` listing what moved, so the diff is legible rather than implied. Whatever comes back is re-baked exactly as a generated shot list is — b-roll designation, then the clip caps — because the model returns creative direction, not a render-ready plan. `final_score` is deliberately left alone: the shot list moved, so the old score no longer describes it, and inventing a new one without running QA would be worse than showing it vi…42325a9 -
Re-record the voiceover when captions are edited
Editing a caption changed only the burned-in words. The voice went on saying the original line, so the finished ad contradicted itself on screen — the one failure mode where the caption feature actively made the video worse. The editor now detects when a clip's cues have drifted from the words it speaks and offers to re-record. `revoice_clip` keeps the existing footage and replaces only the audio: one TTS call plus a mux, seconds rather than the minutes a video regeneration costs. The hard part was a line LONGER than the clip it was written for. `mux_clip_audio` sets the output length with `-t`, so the container came out the right duration with no video in the tail — measured at 100 of the 188 frames a 7.5s clip needs, i.e. 3.5s of nothing. `hold_last_frame` pads the video with a cloned final frame instead, which reads as a held beat; black would read as the video having broken. Existing callers trim to min(video, audio) and never reach it, so their output is unchanged. A split clip…953636e -
Re-derive and re-score a candidate when its script is edited
Saving a script edit changed only the words. The shot list still described the old script and `final_score` still belonged to copy nobody was going to film — both misleading in the same direction, since they make a hand-edited candidate look validated when it hasn't been. A script edit now runs the same three agents the pipeline would: the visual director (the shot list follows the words), the b-roll director (cutaways follow the shot list), and QA (the score follows both). Three Gemini calls, so it goes through Celery and appears in the jobs tray as "Re-score". Details that matter: - Only a SCRIPT change triggers the resync. Editing the shot list by hand does not regenerate it — that would throw the edit away. `resync_visuals=false` re-scores without touching the visuals at all. - The visual director is shown the previous shot list alongside the new script and told to keep what still works. Re-deriving from scratch would lose the presenter's description, and the face would d…17fd563 -
Size burned-in text against a reference frame; animate its arrival
The size bug was not a bad default. Seedance renders 720x1280 and stitch_clips scales to HEIGHT 720, which on portrait footage produces a 406px-wide output — so the default 52 "px" caption was 13% of the frame width, wrapping a four-word cue into a wall of giant stacked text. Sizes are now quoted against a 1080-wide reference frame and scaled to whatever the real frame is, so one number means the same thing everywhere: measured at ~4.9% of frame width across 1080/720/540/406, and a cue box that went from overflowing to 60% of the width. frontend/src/components/editor/preview.ts mirrors the same reference width, and deliberately keys off the PREVIEW's width rather than the source clip's: the editor previews 720-wide clips while the export is 406 wide, so anything derived from the source would disagree with the finished video. overlayStyle's `scale` argument is gone — it was that source-derived number. Animated text: TEXT_ANIMATIONS gives each box an alpha ramp in and out — `fade` (0.2…ea3084e -
Render the trend report in the Activity timeline
The report was landing in the audit log as raw JSON. This gives the `trends` stage a proper panel, following the per-stage renderer pattern the other stages use. The reconciliation is the point of the agent, so it gets the most prominent treatment: "Confirmed by our data" and "Contradicted by our data" sit side by side with equal weight, rather than the conflicts being buried. Each signal is a card carrying the two fields that make it actionable — the psychological mechanism, and what to do about it in this niche — plus its momentum badge, its confidence, and the sites it was observed on. Saturated patterns are struck through, and the audience's own phrasing is quoted. The raw grounded-search prose is kept but collapsed: the panel's value is the reconciled verdict, not the transcript, though a trend you can't trace back to what was actually read is a trend you can't sanity-check. CompletedDetail gains a one-line summary — signal count, source count, and how many trends our own data …885ab08
-
Add background-job tracking; rebuild editor placement, split and trim
Editor - Text (captions and titles) is now placed by dragging it on the frame. `x`/`y` are frame fractions addressing the box's centre, clamped so a box dragged to an edge stays fully on screen. The `position` presets still apply when they're absent, so the render pipeline's own captions and older payloads are unaffected. Placement is computed in Python rather than as an ffmpeg `overlay=x=...` expression: those need commas, and comma escaping inside a filtergraph differs between ffmpeg builds. - Split at the playhead. Both halves keep the same manifest index, so the export trims one source file twice and nothing is regenerated. The spoken line is divided with the cut (EditClip.spoken) or both halves would be captioned with the whole sentence; titles anchored past the cut re-anchor to the second half. - Trim by dragging a clip's edges, with the playhead parked on the exact frame being dragged to. Undo/redo over clips, titles and caption edits, with a drag coalescin…9d66133
-
Composite the editor preview in the browser so edits show up live
The preview was a single <video> whose src was swapped per clip, so every cut re-fetched from the CDN and stalled, and captions/titles/music existed only in ffmpeg at export — you styled a caption and saw nothing until a multi-minute round trip. Now the playhead (global timeline seconds) is the single source of truth: one <video> per clip stays mounted and preloaded and only the active one is shown, so playback is gapless; captions and titles are drawn as DOM boxes using the export's own geometry (preview.ts mirrors _render_overlay_png and _OVERLAY_Y, scaled by previewWidth/videoWidth); music previews through a synced <audio>. The timeline scrubs on click/drag and space toggles playback. Fixes three ways an edit could silently corrupt: - Caption edits were keyed by array index, so reordering or trimming a clip moved hand-edited text onto different words. Cues now carry a stable clip-key#ordinal identity. - Titles held absolute timeline seconds while trims moved the timeline under …a7ec099 -
Trim TTS room tone so clips cut on the last word; live trim preview
Auto-trim was missing, not broken: trim_to_speech() existed in video.py but had no callers, so nothing ever cut the dead air. Measured on the last render, every clip ran ~0.9s past its final word — 5.5s across six clips. The cause wasn't Seedance's whole-second rounding but Gemini TTS, which ends a line with ~0.4s of its own room tone. Clip length is derived from the voiceover, so that silence propagated into the cut and inflated the deliberate 0.5s tail to ~0.9s. trim_trailing_silence() cuts the WAV before it sizes anything, which fixes the clip length and the caption timing derived from it in one place; a silence block that doesn't reach EOF is left alone so a pause mid-line survives. mux_clip_audio now also gets the voiceover length rather than the clip's own, so b-roll no longer keeps Seedance's 4s-floor padding. trim_to_speech is deleted — it guessed at silence on the rendered video to solve the same problem worse. The editor preview ignored in/out entirely, so trimming showed n…5756769 -
Fix clip regenerate on renders made before prompts were saved
Blank prompt now means "regenerate as-is": the editor prefills the stored prompt from the manifest so it's visible and editable. Older renders have no stored prompt — presenter clips can still re-animate (OmniHuman's prompt is optional), and b-roll now gets a clear message to type one instead of an opaque error. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>d8c315c -
Speed up renders 5-8x; caption font/background; per-clip regenerate & upload
1. Speed: clips now render CONCURRENTLY. OmniHuman animates a shared portrait and b-roll is text-to-video, so no clip depends on another — a render takes about as long as its slowest clip instead of the sum. TTS is parallel too. 2. Captions: font family picker (10 system families) and background colour + opacity ("none" for no scrim), for captions and text overlays. New GET /fonts. 3. Per-clip editing: regenerate a clip's visual and/or voiceover, or upload your own video for it. Regenerating b-roll passes the OLD clip as the model's reference so the new take continues from it; the previous file is kept as clip_NN.prev.mp4. Presenter regen reuses the existing face. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>ee24c50 -
Editor: real timeline with tracks, script-based captions, Captions tab
- Timeline: time ruler + video/voice/captions/music tracks, proportional clip widths, drag-reorder, click-to-select - Captions from the script we already generate (free, instant, correctly spelled) rendered via Pillow->overlay; Whisper/Replicate now optional - Tabs: Clip (trim/delete) | Captions (source, style, editable cues) | Text (overlays) | Audio (music bed + voice track listing) - Seedance lip-sync now driven by our own Gemini voice (reference_audios + [Audio1], generate_audio=False) so voice stays consistent AND mouth syncs Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>3a9e0f4
-
Deploy Creative Brain to Hugging Face Spaces (Docker)
Single-container Dockerfile (frontend build + ffmpeg + redis + celery + API on 7860), FastAPI serves the SPA, README front-matter, safe .gitignore. Runtime media (generated_videos/) is excluded — the app regenerates it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>b327bf6