Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 33 additions & 42 deletions dashboard/model_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@
MODEL_TYPE_NN_SINGLE = "Neural Network (single)"
MODEL_TYPE_NN_ENSEMBLE = "Neural Network (ensemble)"
AMSC_LOGO_PATH = LOGO_DIR / "AmSC_300px.png"
AMSC_LOGO_URL = (
LocalFileManager(LOGO_DIR).url("amsc_logo", AMSC_LOGO_PATH)
if AMSC_LOGO_PATH.is_file()
else None
)
AMSC_LOGO_URL = LocalFileManager(LOGO_DIR).url("amsc_logo", AMSC_LOGO_PATH)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AmSC logo is shipped with the repository and is always available at dashboard/logos/AmSC_300px.png.

MODEL_DOWNLOAD_ACTIVE_EXPR = "model_downloading"
AMSC_MLFLOW_LINK_ACTIVE_EXPR = (
f"model_available && model_mlflow_tracking_uri === '{AMSC_MLFLOW_URL}'"
Expand Down Expand Up @@ -490,71 +486,66 @@ def panel(self):
MODEL_TYPE_NN_SINGLE,
MODEL_TYPE_NN_ENSEMBLE,
]
model_type_cols = 8 if AMSC_LOGO_URL else 12
with vuetify.VExpansionPanels(v_model=("expand_panel_control_model", 0)):
with vuetify.VExpansionPanel(
title="Control: Models",
style="font-size: 20px; font-weight: 500;",
):
with vuetify.VExpansionPanelText():
with vuetify.VRow(align="center"):
with vuetify.VCol(
cols=model_type_cols, classes="d-flex align-center"
):
with vuetify.VCol(cols=8, classes="d-flex align-center"):
vuetify.VSelect(
v_model=("model_type_verbose",),
label="Model type",
items=(model_type_list,),
dense=True,
hide_details=True,
)
if AMSC_LOGO_URL:
with vuetify.VCol(
cols=4,
classes="d-flex align-center",
with vuetify.VCol(
cols=4,
classes="d-flex align-center",
):
with html.A(
v_if=(AMSC_MLFLOW_LINK_ACTIVE_EXPR,),
href=(AMSC_MLFLOW_MODEL_URL_EXPR,),
target="_blank",
rel="noopener noreferrer",
title="Open selected model in AmSC MLflow",
style=(
"display: block; width: 100%; "
"max-width: 300px; margin-left: auto; "
"cursor: pointer;"
),
):
with html.A(
v_if=(AMSC_MLFLOW_LINK_ACTIVE_EXPR,),
href=(AMSC_MLFLOW_MODEL_URL_EXPR,),
target="_blank",
rel="noopener noreferrer",
title="Open selected model in AmSC MLflow",
style=(
"display: block; width: 100%; "
"max-width: 300px; margin-left: auto; "
"cursor: pointer;"
),
):
vuetify.VImg(
src=AMSC_LOGO_URL,
alt="AmSC",
max_width=300,
max_height=72,
contain=True,
style="width: 100%;",
)
vuetify.VImg(
v_if=(f"!({AMSC_MLFLOW_LINK_ACTIVE_EXPR})",),
src=AMSC_LOGO_URL,
alt="AmSC",
max_width=300,
max_height=72,
contain=True,
title=(
"Selected model is not available in AmSC MLflow"
),
style=(
"width: 100%; max-width: 300px; "
"margin-left: auto;"
),
style="width: 100%;",
)
vuetify.VImg(
v_if=(f"!({AMSC_MLFLOW_LINK_ACTIVE_EXPR})",),
src=AMSC_LOGO_URL,
alt="AmSC",
max_width=300,
max_height=72,
contain=True,
title=(
"Selected model is not available in AmSC MLflow"
),
style=(
"width: 100%; max-width: 300px; margin-left: auto;"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This style changed (all specs on one line) was enforced by Ruff through pre-commit.

),
)
with vuetify.VRow(
v_if=(MODEL_DOWNLOAD_ACTIVE_EXPR,),
no_gutters=True,
align="center",
style="margin-top: -8px; margin-bottom: 8px;",
):
with vuetify.VCol(cols=model_type_cols):
with vuetify.VCol():

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The model download progress bar, which is displayed in its own empty row, now spans the entire width of the card, from the left side of the model type selector to the right side of the AmSC logo.

with html.Div(
classes=(
"d-flex align-center text-caption "
Expand Down