Spaces:
Running
Running
Commit History
22 days ago
-
Avatar swap: speak in the avatar's voice, handle burned-in captions, skip faceless segments
- Swapped segments go to the model only when a face is on screen for a real share of them; a shot of only a hand had the avatar drawn into it. - Burned-in captions came out scrambled, the models repaint the frame. A three-way choice: keep, paint them out (letter-level OpenCV inpaint, held a quarter second around each word), or paint out and caption again from the voice in the same look. - Optional ElevenLabs voice-changer pass so the soundtrack is the avatar's own voice, same words and timing; $0.005/s in both cost tables. - Caption transcription can use ElevenLabs Scribe (word stamps ~0.5s truer than Whisper on a swapped ad); default stays Whisper. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>d24bccb
23 days ago
-
Match the swapped face's lips to the voice with a lip-sync pass after the swap
Recast copies the source mouth motion onto the new face and never looks at the audio, so the lips drifted. The stitched swap now goes through sync-lipsync-2 with the source soundtrack, on by default and switchable off, priced at $0.05/s alongside the recast rate. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>2ad6802
24 days ago
-
Let the Avatar swap page take an uploaded photo instead of a library avatar
The swap request takes an avatar id or a product-photo key, exactly one; the key must match the pattern the image upload route writes, so the worker can only read back what that route stored. The page adds an upload button beside the avatar picker, and choosing one clears the other. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>3735166 -
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
30 days ago
-
Return the resync job id from the visual chat, so the page can follow it
The last push's VisualChat read `revalidation_task_id` off the result, but the field and the route that sets it were left behind, and the deploy build failed on the missing type. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>28e72e2
-
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
-
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
-
Make the learning scoreboard writable, and stop hiding when it isn't
element_tallies has 0 rows while two agents are instructed to rely on it — the hook writer is told to "prefer types with more wins", the strategist the same. Both have been reading an empty table, so every learning-loop claim in this codebase was decorative. Diagnosed by probing rather than by reading: a check constraint on `niche` rejects EVERY value — all 14 niches.key entries, 'general', and NULL, each failing with 23514 element_tallies_niche_check. The table can never accept a row, so there is no application-side workaround. (The probe left nothing behind; failed inserts write nothing and the one that had to be tried was deleted.) An earlier note in _bump_tally guessed the constraint was about invalid niches. It is not: every niche in the registry is valid and none is accepted. - 0004 drops the constraint, adds a unique index on (niche, element_type, element_value) so two concurrent gradings cannot split one element's score, and backfills from every already-graded render AND…2595919 -
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
-
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 -
Show true totals on the dashboard tiles, counted in the database
The tiles counted whatever rows happened to be loaded, so with 36 generations in the account "Total" read 30. Relabelling it "Loaded" with a trailing + made it honest but not useful — the number you want is the real one. GET /generations/stats counts in postgREST instead, so the payload is one row whatever the table size: a dashboard total must not get more expensive as the account fills up. `completed` and `failed` are counted exactly the way _derive_run_state derives a status — a filled agent_outputs, or human_flag without one — so the tiles agree with the badges on the rows beneath them, and `in_progress` is the remainder (clamped, since a row can be both flagged and finished). Declared BEFORE /generations/{asset_id}: FastAPI matches in declaration order, so the other way round "stats" is parsed as a UUID and 422s. Both directions are tested — that stats resolves, and that adding a literal path didn't shadow the detail route. The tiles fall back to counting loaded rows if the sta…38d1deb -
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
-
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
-
Store renders, clips and uploads in Cloudflare R2
Media now goes through one storage facade (app/services/media.py) with two backends: "r2" (durable, zero egress, and no longer requires the API and worker to share a filesystem) and "local" for dev. Object keys group everything for a render under one prefix with the niche in the path: creative-brain/renders/<niche>/<file>.mp4 creative-brain/edits/<niche>/<render_id>/clip_00.mp4 creative-brain/edits/<niche>/<render_id>/manifest.json creative-brain/uploads/<niche>/<hex>.<ext> The DB stores the object KEY (in renders.file_name) rather than a full URL, so rows survive a domain change; the API resolves keys to https://adgen.statics.lookfinity.net/<key>. /media is only mounted in local mode. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>10377fa -
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