diff --git a/run.py b/run.py index 7fefacb..34e6416 100644 --- a/run.py +++ b/run.py @@ -111,6 +111,7 @@ def generate_app( latest_core_version: str, setting_loader: SettingLoader, preset_manager: PresetManager, + cancellable_engine: None = None, root_dir: Optional[Path] = None, cors_policy_mode: CorsPolicyMode = CorsPolicyMode.localapps, allow_origin: Optional[List[str]] = None, @@ -193,7 +194,7 @@ async def block_origin_middleware(request: Request, call_next): # @app.on_event("startup") # async def start_catch_disconnection(): - # if args.enable_cancellable_synthesis: + # if cancellable_engine is not None: # loop = asyncio.get_event_loop() # _ = loop.create_task(cancellable_engine.catch_disconnection()) @@ -1111,7 +1112,7 @@ def custom_openapi(): return app -if __name__ == "__main__": +def main() -> None: output_log_utf8 = os.getenv("VV_OUTPUT_LOG_UTF8", default="") if output_log_utf8 == "1": @@ -1122,8 +1123,6 @@ def custom_openapi(): file=sys.stderr, ) - default_cors_policy_mode = CorsPolicyMode.localapps - parser = argparse.ArgumentParser(description="VOICEVOX のエンジンです。") parser.add_argument("--host", type=str, default=None, help="接続を受け付けるホストアドレスです。") parser.add_argument("--port", type=int, default=None, help="接続を受け付けるポート番号です。") @@ -1288,6 +1287,7 @@ def custom_openapi(): latest_core_version, setting_loader, preset_manager=preset_manager, + cancellable_engine=cancellable_engine, root_dir=root_dir, cors_policy_mode=cors_policy_mode, allow_origin=allow_origin, @@ -1296,3 +1296,7 @@ def custom_openapi(): host=host, port=port, ) + + +if __name__ == "__main__": + main()