-
Notifications
You must be signed in to change notification settings - Fork 4
Simplify code in ModelManager class #442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
| MODEL_DOWNLOAD_ACTIVE_EXPR = "model_downloading" | ||
| AMSC_MLFLOW_LINK_ACTIVE_EXPR = ( | ||
| f"model_available && model_mlflow_tracking_uri === '{AMSC_MLFLOW_URL}'" | ||
|
|
@@ -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;" | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(): | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 " | ||
|
|
||
There was a problem hiding this comment.
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.