From a71b96a20c0b41fbfabcb8ecb1899e96df6788d8 Mon Sep 17 00:00:00 2001 From: kingbri Date: Tue, 26 Dec 2023 22:57:45 -0500 Subject: [PATCH] Main: Switch to entrypoint Allows for other modules to access the startup function. Signed-off-by: kingbri --- main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 8175c72..7c5f2c6 100644 --- a/main.py +++ b/main.py @@ -476,7 +476,10 @@ async def generate_chat_completion(request: Request, data: ChatCompletionRequest return response -if __name__ == "__main__": +def entrypoint(): + """Entry function for program startup""" + global MODEL_CONTAINER + # Load from YAML config read_config_from_file(pathlib.Path("config.yml")) @@ -522,3 +525,6 @@ if __name__ == "__main__": port=network_config.get("port", 5000), log_level="debug", ) + +if __name__ == "__main__": + entrypoint()