mod-higgsfield / README.md
github-actions[bot]
Automated Deploy: 58555e752292dd34bbb1312f29d5942a18053eaa
9ec7973
|
Raw History Blame Contribute Delete
5.61 kB
---
title: Mod Motion
emoji: 🎬
colorFrom: green
colorTo: gray
sdk: docker
app_port: 7860
suggested_hardware: a100-large
startup_duration_timeout: 1h
---
# Mod Motion — influencer talking videos
Turns a seeded character and a short script into a finished vertical clip for Instagram Reels and
YouTube Shorts: the character speaks the script in their cloned voice, b-roll cutaways play over the
voice, and captions are burned in. No paid generation service is used.
**Status: not yet run on a GPU.** The API, queue, assembly maths and MCP tools are covered by tests.
The model steps (voice, talking head, b-roll) and the Docker image have not been built or measured.
The first deploy to the A100 Space is the benchmark that decides whether these models stay.
## Pipeline
| Step | Model | Licence |
| --- | --- | --- |
| Voice | [Qwen3-TTS 1.7B Base](https://huggingface.co/Qwen/Qwen3-TTS-12Hz-1.7B-Base), cloned from `voice.wav` | Apache-2.0 |
| Talking head | [InfiniteTalk](https://github.com/MeiGen-AI/InfiniteTalk) on Wan 2.1 I2V 14B with the 4-step lightx2v LoRA, 720p portrait | Apache-2.0 |
| B-roll | [Wan 2.2 TI2V-5B](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B-Diffusers), 704x1280 | Apache-2.0 |
| Caption timing | [faster-whisper small.en](https://huggingface.co/Systran/faster-whisper-small.en) on CPU | MIT |
| Assembly | ffmpeg | - |
Every weight is pinned to a commit in `config/models.json`. The Kijai LoRA repository declares no
licence on its card; the LoRA originates from lightx2v (Apache-2.0). Confirm before commercial launch.
## Output format
1080x1920, 25 fps, H.264 High yuv420p at about 10 Mbit/s, AAC stereo 48 kHz normalised to -14 LUFS,
`+faststart`, at most 15 seconds. Captions sit above the bottom 26% of the frame, clear of the
Reels/Shorts interface. 25 fps is the talking-head model's native rate and both platforms accept it.
## Characters
Seed each character as a folder under `config/characters/`; see `config/characters/README.md`.
The worker will not start with no characters. These files hold a real person's face and voice:
keep the GitHub repository and the Space private.
## Using it from Claude
The API serves an MCP endpoint at `/mcp` (streamable HTTP) with three tools: `list_characters`,
`create_video`, `get_video`. Add it as a custom connector with the header
`Authorization: Bearer <API_TOKEN>`, and install `skills/influencer-video/` so Claude knows how to
write the script and place b-roll. Claude writes the plan; this service renders it.
The web page (`web/`) is the simple path: pick a character, type the script, no b-roll.
## Deployment
Docker Space on **A100-large (80 GB)**. Set these Space variables/secrets:
```text
API_TOKEN=<secret, 24+ characters> # required; the app refuses to start without it
PUBLIC_URL=https://YOUR-SPACE.hf.space # used for video links returned to Claude
ALLOWED_ORIGINS=https://YOUR-FRONTEND-ORIGIN
STORAGE_ROOT=/data/mod-motion # if persistent storage is mounted
HF_HOME=/data/huggingface
```
Remove the old `GPU_MEMORY_BUDGET_GB` variable. Keep `WORKER_CONCURRENCY=1`.
- **Database:** the job table's mode constraint changed and nothing migrates it. Delete the old
`jobs.sqlite3` under `STORAGE_ROOT` once before the first start; old test jobs are lost.
- **Disk:** the weights are roughly 130 GB (the Wan 2.1 14B base alone is about 80 GB). This is an
estimate from the repository listings, not a measurement.
- **Access:** every `/api` and `/mcp` request needs the token. Artifact links
(`/api/v1/artifacts/{id}`) are the exception so a video tag or a pasted link can play them; the
IDs are random and unguessable, and anyone holding a link can watch that video.
- Pushes to `main` run tests and deploy the backend to the Space. A rebuild interrupts a running job.
- The frontend deploys separately on Vercel: root `web`, build `node build.mjs`, variable `API_URL`.
## Benchmark
After the worker reports ready:
```sh
API_TOKEN=... python3 scripts/benchmark.py https://YOUR-SPACE.hf.space --character maya --runs 3
```
It submits real jobs, prints each stage, the per-step timings (`voice`, `caption`, `avatar`, `broll`,
`assemble`) and the output links, and exits nonzero if a run fails or exceeds `--target-seconds`
(default 600). Watch every clip on a phone: lip sync, face identity, caption position, cut timing.
## API and local checks
```sh
.venv/bin/python -m pytest -q
node --check web/app.js
node --test tests/frontend.test.cjs
```
| Endpoint | Behavior |
| --- | --- |
| POST `/api/v1/generations/talking-video` | `{"character_id", "script", "shots": [{"prompt", "start", "duration"}], "captions"}` with `Idempotency-Key` |
| GET `/api/v1/generations/{id}` | Stage, elapsed time, completion timings, error or video URLs |
| POST `/api/v1/generations/{id}/cancel` | Queued jobs only |
| GET `/api/v1/artifacts/{id}` | MP4; add `?download=true` to download |
| GET `/api/v1/characters` | Seeded characters |
| GET `/api/v1/models` | Pinned model and output profile |
| GET `/api/v1/health/workers` | Readiness and ready/busy worker counts |
Scripts are limited to 40 words; up to 3 non-overlapping b-roll shots of 1-5 seconds. Shots that run
past the end of the voice are trimmed or dropped. Up to three pending jobs are accepted.
## Known limits
- The talking-head model is reloaded for every job (about a minute of overhead, unmeasured).
- The character appears only in the talking shots; b-roll shows objects and places.
- B-roll is text-to-video only; product photos are not used yet.
- `docs/` describes earlier Wan/LTX experiments and is out of date.