Skip to content

Commit

Permalink
autostart
Browse files Browse the repository at this point in the history
  • Loading branch information
almazgimaev committed Aug 28, 2024
1 parent 503dc09 commit ee9263e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"modal_template": "src/modal.html",
"modal_template_state": {
"sessionId": null,
"autoStart": false,
"sessionOptions": {
"sessionTags": ["deployed_nn"],
"showLabel": false,
Expand Down
2 changes: 2 additions & 0 deletions src/globals.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from distutils.util import strtobool

from dotenv import load_dotenv

Expand All @@ -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")))
5 changes: 4 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def handle(session_id: Optional[int]):


@button.click
def handle():
def start_evaluation():
creating_report_f.show()
main_func()

Expand All @@ -115,3 +115,6 @@ def handle():

if g.session_id:
sel_app_session.set_session_id(g.session_id)

if g.autostart:
start_evaluation()
23 changes: 16 additions & 7 deletions src/modal.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
<div id="embeddings-calculator">
<sly-field title="Select Served session" description="select ">
<sly-select-app-session :group-id="context.teamId"
:app-session-id.sync="state.sessionId"
:options="state.sessionOptions">
</sly-select-app-session>
</sly-field>
</div>
<sly-field title="Select Served session" description="select ">
<sly-select-app-session
:group-id="context.teamId"
:app-session-id.sync="state.sessionId"
:options="state.sessionOptions"
>
</sly-select-app-session>
</sly-field>
<sly-field
v-if="state.sessionId"
title="Auto start"
description="Specify if the evaluation should start automatically after the app starts"
>
<el-checkbox v-model="state.autoStart">Enable</el-checkbox>
</sly-field>
</div>

0 comments on commit ee9263e

Please sign in to comment.