Download scripts/make_samples.py from broduer/Jarvis: direct link, hf CLI and curl.
- Browser
- Download file 1.85 kB
-
https://huggingface.co/broduer/Jarvis/resolve/main/scripts/make_samples.py
- Command line
-
hf download hf://broduer/Jarvis/scripts/make_samples.py
-
curl -L -o make_samples.py https://huggingface.co/broduer/Jarvis/resolve/main/scripts/make_samples.py
1.85 kB
| #!/usr/bin/env python3 | |
| """Render the demo WAVs shipped in ``samples/``. | |
| python scripts/make_samples.py | |
| Every file is produced by the engine in this package with the packaged style | |
| vectors, at the packaged default speed, using the JARVIS delivery plan. Rerun it | |
| after changing a preset or the delivery pacing so the demos stay honest. | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| from pathlib import Path | |
| from jarvis_lvm.engine import DEFAULT_SPEED, JarvisLVM | |
| LINES = { | |
| "greeting": "Good evening, sir. All systems are functioning within normal parameters.", | |
| "briefing": ( | |
| "I have reviewed the overnight telemetry, and the results are " | |
| "encouraging. Your calendar is clear for the next two hours." | |
| ), | |
| "status": ( | |
| "Reactor output is steady at ninety-four percent. Cooling is nominal, " | |
| "and no faults were logged since your last check." | |
| ), | |
| } | |
| PRESETS = ("jarvis-prime", "jarvis-classic", "jarvis-deep") | |
| def main() -> None: | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--out", type=Path, default=Path("samples")) | |
| parser.add_argument("--speed", type=float, default=DEFAULT_SPEED) | |
| parser.add_argument("--style", default="jarvis", choices=("jarvis", "off")) | |
| args = parser.parse_args() | |
| model = JarvisLVM() | |
| args.out.mkdir(parents=True, exist_ok=True) | |
| for preset in PRESETS: | |
| for name, text in LINES.items(): | |
| result = model.synthesize( | |
| text, voice=preset, speed=args.speed, style=args.style | |
| ) | |
| path = args.out / f"{preset}-{name}.wav" | |
| path.write_bytes(result.wav) | |
| print( | |
| f"{path} {result.seconds}s segments={result.segments} " | |
| f"style={result.style}" | |
| ) | |
| if __name__ == "__main__": | |
| main() | |