Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download duplex_demo.py from treble-technologies/ffasr: direct link, hf CLI and curl.
- Browser
- Download file 3.34 kB
-
https://huggingface.co/spaces/treble-technologies/ffasr/resolve/main/duplex_demo.py
- Command line
-
hf download hf://spaces/treble-technologies/ffasr/duplex_demo.py
-
curl -L -o duplex_demo.py https://huggingface.co/spaces/treble-technologies/ffasr/resolve/main/duplex_demo.py
3.34 kB
| """ | |
| Placeholder full-duplex rows for local demos (``FFASR_DUPLEX_DEMO=1``). | |
| The rows are generated in memory and tagged ``eval_family="demo"``. They are made-up | |
| numbers that only exercise the table and charts; they are not results of the named | |
| systems (hence the ``-style`` suffix). | |
| """ | |
| from __future__ import annotations | |
| import os | |
| from duplex_config import CSV_FIELDS, METRIC_KEYS, metric_column | |
| DEMO_FAMILY = "demo" | |
| # Far-field profile per model (values in ``METRIC_KEYS`` order): | |
| # (model id, architecture, pause_tor, turn_tor, bargein_tor, false_bargein, echo_stop, | |
| # bc_jsd, resp_latency_s, stop_latency_s, bargein_score, glasses echo multiplier) | |
| _MODELS: tuple[tuple, ...] = ( | |
| ("demo/gpt-realtime-style", "End-to-end", 0.22, 0.93, 0.86, 0.30, 0.07, 0.71, 1.05, 0.55, 3.9, 1.4), | |
| ("demo/gemini-live-style", "End-to-end", 0.18, 0.92, 0.82, 0.34, 0.06, 0.78, 1.35, 0.65, 3.8, 1.3), | |
| ("demo/moshi-style", "End-to-end", 0.55, 0.96, 0.60, 0.14, 0.20, 0.52, 0.52, 1.70, 2.4, 2.6), | |
| ("demo/personaplex-style", "End-to-end", 0.38, 0.95, 0.79, 0.20, 0.13, 0.46, 0.48, 0.72, 3.2, 1.5), | |
| ("demo/freeze-omni-style", "End-to-end", 0.12, 0.83, 0.74, 0.40, 0.17, 0.93, 1.25, 0.80, 3.0, 2.0), | |
| ("demo/nemotron-voicechat-style", "End-to-end", 0.27, 0.94, 0.81, 0.25, 0.11, 0.40, 0.65, 0.60, 3.4, 1.3), | |
| ("demo/cascade-vad-asr-llm-tts", "Cascaded", 0.31, 0.92, 0.88, 0.55, 0.33, 0.95, 1.95, 0.40, 3.6, 2.4), | |
| ("demo/cascade-semantic-eot", "Cascaded", 0.09, 0.90, 0.84, 0.23, 0.09, 0.88, 1.45, 0.45, 3.7, 3.5), | |
| ) | |
| def enabled() -> bool: | |
| return os.environ.get("FFASR_DUPLEX_DEMO", "").strip().lower() in {"1", "true", "yes", "on"} | |
| def is_demo_row(row: dict) -> bool: | |
| return str(row.get("eval_family") or "").strip() == DEMO_FAMILY | |
| def _clip(v: float) -> float: | |
| return min(0.99, max(0.0, v)) | |
| def demo_rows() -> list[dict]: | |
| rows: list[dict] = [] | |
| for idx, (model_id, arch, pause, turn, bargein, false_bi, echo, jsd, resp, stop, score, echo_mult) in enumerate( | |
| _MODELS | |
| ): | |
| # Smart glasses: the wearer's voice is close to the mics, so turn ends and barge-ins | |
| # are easier to catch; bystanders are louder and the speakers sit next to the mics, | |
| # so false barge-ins and echo self-stops go up. | |
| per_cond = { | |
| "farfield": (pause, turn, bargein, false_bi, echo, jsd, resp, stop, score), | |
| "glasses": ( | |
| _clip(pause - 0.03), | |
| _clip(turn + 0.04), | |
| _clip(bargein + 0.07), | |
| _clip(false_bi + 0.06 + 0.05 * (idx % 4)), | |
| _clip(echo * echo_mult), | |
| _clip(jsd - 0.02), | |
| max(0.2, resp - 0.18), | |
| max(0.2, stop - 0.10), | |
| min(5.0, score + 0.1), | |
| ), | |
| } | |
| row = {k: "" for k in CSV_FIELDS} | |
| row["model_id"] = model_id | |
| row["eval_family"] = DEMO_FAMILY | |
| row["architecture"] = arch | |
| for cond, vals in per_cond.items(): | |
| for metric, v in zip(METRIC_KEYS, vals): | |
| row[metric_column(metric, cond)] = f"{v:.4f}" | |
| row["num_samples"] = "1200" | |
| row["submitted_at"] = f"2026-09-{idx + 10:02d}T12:00:00+00:00" | |
| row["submission_notes"] = "Placeholder row for a local demo; not a real result." | |
| rows.append(row) | |
| return rows | |