Spaces:
Running on Zero
Running on Zero
| import traceback | |
| import numpy as np | |
| try: | |
| import spaces | |
| except ModuleNotFoundError: | |
| import types | |
| spaces = types.SimpleNamespace(GPU=lambda fn: fn) | |
| from backend.orchestrator import run_pipeline | |
| from backend.presets import list_presets | |
| from frontend.layout import build_app, CUSTOM_CSS | |
| def _gpu_probe() -> None: | |
| pass | |
| def _warmup() -> None: | |
| sr = 16000 | |
| dummy = np.zeros(sr, dtype=np.float32) | |
| for preset in list_presets(): | |
| if not preset.get('available'): | |
| continue | |
| try: | |
| run_pipeline(preset['config'], dummy, sample_rate=sr, preset_label=preset['label']) | |
| print(f'[warmup] ready: {preset['label']}') | |
| except Exception as exc: | |
| print(f'[warmup] skipped {preset['label']}: {exc}') | |
| traceback.print_exc() | |
| print('[warmup] done') | |
| if __name__ == '__main__': | |
| _gpu_probe() | |
| _warmup() | |
| demo = build_app() | |
| demo.launch(share=False, css=CUSTOM_CSS) |