From ee9263e594bf39e1e73b1eadd079b64330d066d5 Mon Sep 17 00:00:00 2001 From: almaz Date: Wed, 28 Aug 2024 17:17:01 +0200 Subject: [PATCH] autostart --- config.json | 1 + src/globals.py | 2 ++ src/main.py | 5 ++++- src/modal.html | 23 ++++++++++++++++------- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/config.json b/config.json index 68659a7..426fdb7 100644 --- a/config.json +++ b/config.json @@ -19,6 +19,7 @@ "modal_template": "src/modal.html", "modal_template_state": { "sessionId": null, + "autoStart": false, "sessionOptions": { "sessionTags": ["deployed_nn"], "showLabel": false, diff --git a/src/globals.py b/src/globals.py index 543c631..3b116fd 100644 --- a/src/globals.py +++ b/src/globals.py @@ -1,4 +1,5 @@ import os +from distutils.util import strtobool from dotenv import load_dotenv @@ -25,3 +26,4 @@ session_id = os.environ.get("modal.state.sessionId", None) if session_id is not None: session_id = int(session_id) +autostart = bool(strtobool(os.environ.get("modal.state.autoStart", "false"))) diff --git a/src/main.py b/src/main.py index 748a8e3..c1a5532 100644 --- a/src/main.py +++ b/src/main.py @@ -103,7 +103,7 @@ def handle(session_id: Optional[int]): @button.click -def handle(): +def start_evaluation(): creating_report_f.show() main_func() @@ -115,3 +115,6 @@ def handle(): if g.session_id: sel_app_session.set_session_id(g.session_id) + +if g.autostart: + start_evaluation() \ No newline at end of file diff --git a/src/modal.html b/src/modal.html index 782571d..c5fffcd 100644 --- a/src/modal.html +++ b/src/modal.html @@ -1,8 +1,17 @@
- - - - -
\ No newline at end of file + + + + + + Enable + +