Redesign workbench dashboard shell

#1
by F4RUKYLDRM - opened
.gitignore CHANGED
@@ -5,3 +5,4 @@ __pycache__/
5
  *.zip
6
  *.csv
7
  !tests/fixtures/*.csv
 
 
5
  *.zip
6
  *.csv
7
  !tests/fixtures/*.csv
8
+ design_handoff_workbench_redesign/
app.py CHANGED
The diff for this file is too large to render. See raw diff
 
biolmnet/data.py CHANGED
@@ -57,6 +57,12 @@ def _normalise_columns(frame: pd.DataFrame) -> pd.DataFrame:
57
  return result
58
 
59
 
 
 
 
 
 
 
60
  def read_csv(source: str | Path | BinaryIO) -> pd.DataFrame:
61
  if hasattr(source, "read"):
62
  return _normalise_columns(pd.read_csv(source))
@@ -415,8 +421,7 @@ def load_genept_embeddings(filename: str) -> pd.DataFrame:
415
  repo_type="model",
416
  )
417
  frame = pd.read_parquet(path)
418
- frame.index = frame.index.astype(str).str.strip()
419
- return frame
420
 
421
 
422
  def attach_embeddings_and_pathways(
@@ -426,6 +431,7 @@ def attach_embeddings_and_pathways(
426
  *,
427
  precomputed_significant: bool,
428
  ) -> pd.DataFrame:
 
429
  embedding_index = set(embedding_frame.index.astype(str))
430
  keep = np.array(
431
  [gene in embedding_index for gene in branch.hidden_genes], dtype=bool
 
57
  return result
58
 
59
 
60
+ def _normalise_embedding_index(frame: pd.DataFrame) -> pd.DataFrame:
61
+ result = frame.copy()
62
+ result.index = result.index.astype(str).str.strip()
63
+ return result[~result.index.duplicated(keep="first")]
64
+
65
+
66
  def read_csv(source: str | Path | BinaryIO) -> pd.DataFrame:
67
  if hasattr(source, "read"):
68
  return _normalise_columns(pd.read_csv(source))
 
421
  repo_type="model",
422
  )
423
  frame = pd.read_parquet(path)
424
+ return _normalise_embedding_index(frame)
 
425
 
426
 
427
  def attach_embeddings_and_pathways(
 
431
  *,
432
  precomputed_significant: bool,
433
  ) -> pd.DataFrame:
434
+ embedding_frame = _normalise_embedding_index(embedding_frame)
435
  embedding_index = set(embedding_frame.index.astype(str))
436
  keep = np.array(
437
  [gene in embedding_index for gene in branch.hidden_genes], dtype=bool
biolmnet/ui/__init__.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ """Pure-presentation UI helpers for the BioLM-NET Workbench.
2
+
3
+ Nothing in this package touches the scientific core (``biolmnet.model``,
4
+ ``biolmnet.data``, ``biolmnet.training``, ``biolmnet.artifacts``). It only
5
+ builds the CSS and HTML fragments ``app.py`` renders around that logic.
6
+ """
7
+
8
+ from . import components # noqa: F401
9
+ from .styles import CSS # noqa: F401
biolmnet/ui/components.py ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """HTML builders for the Workbench shell.
2
+
3
+ Every function here returns a plain HTML string for a ``gr.HTML`` component.
4
+ They only format data already produced by ``biolmnet.data`` /
5
+ ``biolmnet.training`` / ``biolmnet.artifacts`` — none of them compute
6
+ anything scientific.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import html
12
+ from typing import Iterable, Sequence
13
+
14
+ esc = html.escape
15
+
16
+ CORNER_MARKS = (
17
+ '<i class="corner tl"></i><i class="corner tr"></i>'
18
+ '<i class="corner bl"></i><i class="corner br"></i>'
19
+ )
20
+
21
+
22
+ def blueprint_div(inner_html: str, *, extra_class: str = "", style: str = "") -> str:
23
+ """Wrap ``inner_html`` in a blueprint frame (hairline border + corner marks)."""
24
+ cls = f"blueprint {extra_class}".strip()
25
+ style_attr = f' style="{style}"' if style else ""
26
+ return f'<div class="{cls}"{style_attr}>{CORNER_MARKS}{inner_html}</div>'
27
+
28
+
29
+ # ── rail ─────────────────────────────────────────────────────────────────
30
+
31
+ def brand_block_html() -> str:
32
+ return (
33
+ '<div class="rail-brand"><span class="name">BioLM-NET</span>'
34
+ '<div class="mono" style="margin-top:5px">Workbench</div></div>'
35
+ '<div class="mono rail-kicker">Workflow</div>'
36
+ )
37
+
38
+
39
+ def rail_row_html(number: int, label: str, state: str, status_word: str) -> str:
40
+ """One workflow rail row. ``state`` is one of done/on/next/off."""
41
+ return (
42
+ f'<div class="rr {state}">'
43
+ f'<span class="rn">{number:02d}</span>'
44
+ f'<span class="lb">{esc(label)}</span>'
45
+ f'<span class="st">{esc(status_word)}</span>'
46
+ f"</div>"
47
+ )
48
+
49
+
50
+ def kv_row(key: str, value: str, tone: str | None = None) -> str:
51
+ cls = f"num {tone}" if tone else "num"
52
+ return f'<div class="kv"><span>{esc(key)}</span><span class="{cls}">{esc(value)}</span></div>'
53
+
54
+
55
+ def run_state_plate(rows: Sequence[tuple[str, str, str | None]]) -> str:
56
+ """``rows``: (key, value, tone) where tone is None/accent/error/muted."""
57
+ inner = "".join(kv_row(k, v, tone) for k, v, tone in rows)
58
+ return blueprint_div(inner, extra_class="plate")
59
+
60
+
61
+ def kv_plain_row(key: str, value: str, *, last: bool = False) -> str:
62
+ cls = "kv-plain last" if last else "kv-plain"
63
+ return f'<div class="{cls}"><span>{esc(key)}</span><span class="num">{esc(value)}</span></div>'
64
+
65
+
66
+ def footnote_html(line1: str, line2: str) -> str:
67
+ return f'<div class="rail-footnote">{esc(line1)}<br>{esc(line2)}</div>'
68
+
69
+
70
+ # ── topbar / page head ──────────────────────────────────────────────────
71
+
72
+ def topbar_html(stage_no: int, total: int, stage_name: str, session_id: str, right_text: str) -> str:
73
+ # Only the left "STAGE 0n / 05" label is uppercase; the session/device
74
+ # note on the right stays mixed-case (a lowercase-hex session id reading
75
+ # upper-cased is just noise).
76
+ return (
77
+ '<div class="topbar">'
78
+ f'<div class="mono">Stage {stage_no:02d} / {total:02d} — {esc(stage_name)}</div>'
79
+ f'<div class="num" style="font-size:9.5px;letter-spacing:.04em;color:var(--color-muted-2)">'
80
+ f"Session {esc(session_id)} · {esc(right_text)}</div>"
81
+ "</div>"
82
+ )
83
+
84
+
85
+ def title_block_html(title: str, description: str) -> str:
86
+ return f"<h2>{esc(title)}</h2>" f'<div class="desc">{esc(description)}</div>'
87
+
88
+
89
+ def mono_meta_html(lines: Iterable[str], *, align_right: bool = True) -> str:
90
+ align = "text-align:right;" if align_right else ""
91
+ body = "<br>".join(esc(line) for line in lines)
92
+ return f'<div class="mono" style="{align}font-size:9.5px;line-height:1.7">{body}</div>'
93
+
94
+
95
+ # ── stat plates ──────────────────────────────────────────────────────────
96
+
97
+ def stat_plate(value: str, label: str, *, label_first: bool = False) -> str:
98
+ if label_first:
99
+ inner = f'<div class="k">{esc(label)}</div><div class="v">{esc(value)}</div>'
100
+ else:
101
+ inner = f'<div class="v">{esc(value)}</div><div class="k">{esc(label)}</div>'
102
+ return blueprint_div(inner, extra_class="stat")
103
+
104
+
105
+ def mini_stat_html(value: str, label: str) -> str:
106
+ """A label+value pair with no frame of its own (used inside a shared blueprint panel)."""
107
+ return (
108
+ f'<div><div class="mono" style="font-size:9px">{esc(label)}</div>'
109
+ f'<div style="font:600 26px/1.1 var(--font-heading)">{esc(value)}</div></div>'
110
+ )
111
+
112
+
113
+ # ── bars ─────────────────────────────────────────────────────────────────
114
+
115
+ def bar_cell(pct: float, *, height: int = 8) -> str:
116
+ pct = max(0.0, min(100.0, pct))
117
+ return f'<div class="bar" style="height:{height}px"><i style="width:{pct:.1f}%"></i></div>'
118
+
119
+
120
+ def labeled_bar_row(
121
+ label: str, pct: float, value_text: str, *, label_width: int = 78, bar_height: int = 12, value_width: int = 52
122
+ ) -> str:
123
+ return (
124
+ '<div style="display:flex;align-items:center;gap:10px">'
125
+ f'<span style="width:{label_width}px;font-size:12px">{esc(label)}</span>'
126
+ f"{bar_cell(pct, height=bar_height)}"
127
+ f'<span class="num" style="width:{value_width}px;text-align:right">{esc(value_text)}</span>'
128
+ "</div>"
129
+ )
130
+
131
+
132
+ # ── tables ───────────────────────────────────────────────────────────────
133
+
134
+ def table_html(
135
+ headers: Sequence[str],
136
+ rows: Sequence[Sequence[str]],
137
+ *,
138
+ aligns: Sequence[str] | None = None,
139
+ numeric_cols: Sequence[bool] | None = None,
140
+ widths: Sequence[str | None] | None = None,
141
+ ) -> str:
142
+ """Build a ``.tbl`` table. Cell values are raw HTML — escape plain text
143
+ with :data:`esc` before passing it in."""
144
+ n_cols = len(headers)
145
+ aligns = list(aligns) if aligns else ["left"] * n_cols
146
+ numeric_cols = list(numeric_cols) if numeric_cols else [False] * n_cols
147
+ widths = list(widths) if widths else [None] * n_cols
148
+
149
+ head_cells = []
150
+ for header, align, width in zip(headers, aligns, widths):
151
+ style_parts = []
152
+ if width:
153
+ style_parts.append(f"width:{width}")
154
+ if align == "right":
155
+ style_parts.append("text-align:right")
156
+ attr = f' style="{";".join(style_parts)}"' if style_parts else ""
157
+ head_cells.append(f"<th{attr}>{esc(header)}</th>")
158
+
159
+ body_rows = []
160
+ for row in rows:
161
+ cells = []
162
+ for value, align, numeric in zip(row, aligns, numeric_cols):
163
+ cls_attr = ' class="n"' if numeric else ""
164
+ style_attr = ' style="text-align:right"' if align == "right" else ""
165
+ cells.append(f"<td{cls_attr}{style_attr}>{value}</td>")
166
+ body_rows.append(f"<tr>{''.join(cells)}</tr>")
167
+
168
+ return (
169
+ '<table class="tbl"><thead><tr>'
170
+ + "".join(head_cells)
171
+ + "</tr></thead><tbody>"
172
+ + "".join(body_rows)
173
+ + "</tbody></table>"
174
+ )
175
+
176
+
177
+ def confusion_matrix_html(matrix, labels: Sequence[str]) -> str:
178
+ """A tinted CSS grid confusion matrix (rows true, columns predicted)."""
179
+ n = len(labels)
180
+ row_totals = [max(sum(row), 1) for row in matrix]
181
+
182
+ def cell_style(row_index: int, count: float) -> str:
183
+ ratio = count / row_totals[row_index]
184
+ if ratio >= 0.7:
185
+ return "background:var(--color-accent-800);color:#f2f2f3"
186
+ if ratio >= 0.4:
187
+ return "background:var(--color-accent-700);color:#f2f2f3"
188
+ if ratio >= 0.15:
189
+ return "background:var(--color-accent-200)"
190
+ return "background:var(--color-accent-100)"
191
+
192
+ header_cells = "".join(
193
+ f'<div class="mono" style="font-size:8.5px;text-align:center">{esc(label)}</div>' for label in labels
194
+ )
195
+ row_label_cells = "".join(
196
+ f'<div class="mono" style="font-size:8.5px;display:grid;align-items:center">{esc(label)}</div>'
197
+ for label in labels
198
+ )
199
+ body_cells = "".join(
200
+ f'<div style="{cell_style(i, matrix[i][j])}">{int(matrix[i][j])}</div>'
201
+ for i in range(n)
202
+ for j in range(n)
203
+ )
204
+ return (
205
+ '<div style="display:grid;grid-template-columns:56px 1fr;gap:8px">'
206
+ "<div></div>"
207
+ f'<div style="display:grid;grid-template-columns:repeat({n},1fr);gap:2px">{header_cells}</div>'
208
+ f'<div style="display:grid;gap:2px">{row_label_cells}</div>'
209
+ f'<div class="cm" style="--cm-n:{n}">{body_cells}</div>'
210
+ "</div>"
211
+ )
212
+
213
+
214
+ # ── status / validation strips ───────────────────────────────────────────
215
+
216
+ def simple_status_html(message_html: str, *, error: bool = False) -> str:
217
+ cls = "error" if error else "status"
218
+ return f'<div class="strip {cls}"><div class="strip-body" style="flex:1">{message_html}</div></div>'
219
+
220
+
221
+ def strip_text_html(kicker: str, message: str) -> str:
222
+ """The text half of a bordered strip; pair with a real ``gr.Button`` in the
223
+ same ``elem_classes=["strip", ...]`` row for the ghost action."""
224
+ return f'<div class="strip-kicker">{esc(kicker)}</div><div class="strip-body">{esc(message)}</div>'
225
+
226
+
227
+ def empty_note_html(message: str) -> str:
228
+ return f'<div class="empty-note">{esc(message)}</div>'
229
+
230
+
231
+ # ── introduction cards ────────────────────────────────────────────────────
232
+
233
+ INTRO_CARDS = [
234
+ (
235
+ "Introduction · 01 / 06",
236
+ "A network wired along known biology",
237
+ (
238
+ "BioLM-NET classifies tumour samples from <b>paired gene expression and DNA methylation</b>. "
239
+ "Instead of connecting every gene to every neuron, it only makes the connections biology supports — "
240
+ "KEGG pathways, transcription-factor targets, protein interactions — so trained weights can be read "
241
+ "back as pathways rather than as a black box."
242
+ ),
243
+ "This workbench runs the model end to end in five stages. On the bundled BRCA example it takes a few minutes.",
244
+ "",
245
+ ),
246
+ (
247
+ "Introduction · 02 / 06",
248
+ "Five stages, in order",
249
+ (
250
+ "The rail on the left is the spine of the app. Each stage consumes the previous one's output, so a "
251
+ "stage stays <b>locked</b> until its prerequisite exists — you cannot export a model you have not trained."
252
+ ),
253
+ (
254
+ '<div class="intro-stage-list">'
255
+ "<div><em>01</em><span><b>Data &amp; Priors</b> — assemble the masked graph</span></div>"
256
+ "<div><em>02</em><span><b>Train Model</b> — fit it, watch the epochs</span></div>"
257
+ "<div><em>03</em><span><b>Export Artifacts</b> — save a reusable bundle</span></div>"
258
+ "<div><em>04</em><span><b>Predict</b> — score a new cohort</span></div>"
259
+ "<div><em>05</em><span><b>Results</b> — metrics and pathway attention</span></div>"
260
+ "</div>"
261
+ ),
262
+ "The plate under the rail always says what state the model is in",
263
+ ),
264
+ (
265
+ "Introduction · 03 / 06 · Stage 01",
266
+ "Data & Priors",
267
+ (
268
+ "Point the workbench at paired omics — a bundled example, a GitHub folder, or your own upload — with "
269
+ "<b>samples in rows and HGNC symbols in columns</b>. The two matrices are aligned on their shared "
270
+ "samples, and every file is reported with the shape it was read at rather than failing silently."
271
+ ),
272
+ (
273
+ "The priors on the right are the biology that becomes wiring: pathway annotations, the enrichment "
274
+ "cutoff, the GenePT context and the interaction sources. Defaults follow the paper."
275
+ ),
276
+ "Rebuilding clears any trained model",
277
+ ),
278
+ (
279
+ "Introduction · 04 / 06 · Stage 02",
280
+ "Train Model",
281
+ (
282
+ "Hyperparameters sit on the left as a spec sheet. The run panel on the right reports <b>epoch, train "
283
+ "and validation loss, accuracy and ETA</b> as the fit progresses."
284
+ ),
285
+ (
286
+ "Controls lock for the duration of a run and the primary button reads <b>Training on ZeroGPU</b> "
287
+ "until it finishes; Cancel stays available. The GPU is allocated on demand, so the first epoch may "
288
+ "wait for its reservation."
289
+ ),
290
+ "Paper defaults are one click away",
291
+ ),
292
+ (
293
+ "Introduction · 05 / 06 · Stages 03–04",
294
+ "Export, then predict",
295
+ (
296
+ "Export writes one bundle carrying the weights, the fitted preprocessing, the mask and the config — "
297
+ "enough to score new samples later without rebuilding the graph. Its manifest lists what each entry "
298
+ "reproduces, with a checksum."
299
+ ),
300
+ (
301
+ "Predict scores a new cohort with either the session model or an uploaded bundle. Features are "
302
+ "<b>aligned to the artifact first</b>; if a required column is missing, inference is blocked and the "
303
+ "check that failed is named."
304
+ ),
305
+ "Bundles are temp files — download before the Space restarts",
306
+ ),
307
+ (
308
+ "Introduction · 06 / 06 · Stage 05",
309
+ "Reading the results",
310
+ (
311
+ "Results collects everything a run produced: validation metrics, the training curve, the confusion "
312
+ "matrix, an audit of how sparse each layer actually is, and the pathway attention weights — which is "
313
+ "the part the architecture exists to give you."
314
+ ),
315
+ (
316
+ "Treat it as model output, not as biology. <b>Check cohort composition, preprocessing and class "
317
+ "balance before drawing conclusions</b>, and remember that attention weights rank pathways within "
318
+ "this fit rather than proving mechanism."
319
+ ),
320
+ "Research use only · not for clinical decisions",
321
+ ),
322
+ ]
323
+
324
+
325
+ def intro_card_html(index: int) -> str:
326
+ step, title, body_1, body_2, _ = INTRO_CARDS[index]
327
+ return (
328
+ f'<div class="intro-step">{esc(step)}</div>'
329
+ f"<h4>{esc(title)}</h4>"
330
+ f"<p>{body_1}</p>"
331
+ f"<p>{body_2}</p>"
332
+ )
333
+
334
+
335
+ def intro_dots_html(index: int, total: int = 6) -> str:
336
+ return '<div class="intro-dots">' + "".join(
337
+ f'<i class="{"on" if i == index else ""}"></i>' for i in range(total)
338
+ ) + "</div>"
339
+
340
+
341
+ # ── misc ─────────────────────────────────────────────────────────────────
342
+
343
+ def human_bytes(n: float) -> str:
344
+ n = float(n)
345
+ for unit in ("B", "KB", "MB"):
346
+ if n < 1024 or unit == "MB":
347
+ return f"{int(n)} {unit}" if unit == "B" else f"{n:.1f} {unit}"
348
+ n /= 1024
349
+ return f"{n / 1024:.1f} GB"
biolmnet/ui/styles.py ADDED
@@ -0,0 +1,735 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """CSS for the BioLM-NET Workbench, translating the "Industry" design system
2
+ (``_ds/industry-…/styles.css`` in the design handoff bundle) onto Gradio's
3
+ Blocks DOM. Tokens, spacing and component shapes are taken from the design
4
+ system; selectors are written against Gradio's real markup (native inputs,
5
+ the ``primary``/``secondary`` button variant classes, ``:has()`` on real
6
+ ``<label>``/``<input>`` pairs) rather than any custom component.
7
+ """
8
+
9
+ CSS = """
10
+ @import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600&family=Barlow+Condensed:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');
11
+
12
+ :root {
13
+ --color-bg: #f2f2f3;
14
+ --color-surface: #e9e9ea;
15
+ --color-text: #1d1f20;
16
+ --color-accent: #5980a6;
17
+ --color-accent-100: #eef6ff;
18
+ --color-accent-200: #d6ebff;
19
+ --color-accent-600: #597ea3;
20
+ --color-accent-700: #416180;
21
+ --color-accent-800: #2c455d;
22
+ --color-accent-900: #1d2d3d;
23
+ --color-divider: color-mix(in srgb, #1d1f20 16%, transparent);
24
+ --color-row-rule: color-mix(in srgb, #1d1f20 10%, transparent);
25
+ --color-muted: color-mix(in srgb, #1d1f20 62%, transparent);
26
+ --color-muted-2: color-mix(in srgb, #1d1f20 52%, transparent);
27
+ --color-error: oklch(0.52 0.14 27);
28
+ --color-error-fill: color-mix(in srgb, oklch(0.52 0.14 27) 6%, transparent);
29
+
30
+ --font-heading: "Barlow Condensed", system-ui, sans-serif;
31
+ --font-body: "Barlow", system-ui, sans-serif;
32
+ --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
33
+
34
+ --space-1: 3.4px;
35
+ --space-2: 6.8px;
36
+ --space-3: 10.2px;
37
+ --space-4: 13.6px;
38
+ --space-6: 20.4px;
39
+ --space-8: 27.2px;
40
+ --radius-sm: 2px;
41
+ --radius-md: 4px;
42
+ }
43
+
44
+ /* ── neutralize Gradio's own theme ────────────────────────────────────────
45
+ Gradio's Base theme ships its own light AND dark variable sets (the dark
46
+ ones activated by a `.dark` class Gradio's frontend adds on
47
+ `prefers-color-scheme: dark` or `?__theme=dark`), and every unstyled
48
+ component — blocks, panels, tables, checkboxes, the primary button — reads
49
+ colors from those variables, not from ours. Selector-by-selector overrides
50
+ below only reach the elements we thought to target; this instead
51
+ overwrites Gradio's variables directly, for both plain and `.dark`-classed
52
+ roots, so nothing can fall back to Gradio's blue/dark palette. `!important`
53
+ is required: CSS custom properties still cascade normally, and Gradio's
54
+ `.dark` rule is otherwise free to out-order this one depending on where
55
+ the frontend happens to inject each stylesheet. */
56
+ :root, .dark, :root .dark {
57
+ --body-background-fill: #f2f2f3 !important;
58
+ --body-text-color: #1d1f20 !important;
59
+ --body-text-color-subdued: color-mix(in srgb, #1d1f20 55%, transparent) !important;
60
+ --background-fill-primary: #f2f2f3 !important;
61
+ --background-fill-secondary: #e9e9ea !important;
62
+ --border-color-primary: color-mix(in srgb, #1d1f20 16%, transparent) !important;
63
+ --border-color-accent: #5980a6 !important;
64
+ --border-color-accent-subdued: #5980a6 !important;
65
+ --color-accent: #5980a6 !important;
66
+ --color-accent-soft: #eef6ff !important;
67
+ --link-text-color: #416180 !important;
68
+ --link-text-color-hover: #2c455d !important;
69
+ --link-text-color-active: #2c455d !important;
70
+ --link-text-color-visited: #416180 !important;
71
+
72
+ --block-background-fill: transparent !important;
73
+ --block-border-color: color-mix(in srgb, #1d1f20 16%, transparent) !important;
74
+ --block-label-background-fill: transparent !important;
75
+ --block-label-border-color: transparent !important;
76
+ --block-label-text-color: #1d1f20 !important;
77
+ --block-title-text-color: #1d1f20 !important;
78
+ --block-info-text-color: color-mix(in srgb, #1d1f20 62%, transparent) !important;
79
+ --panel-background-fill: transparent !important;
80
+ --panel-border-color: color-mix(in srgb, #1d1f20 16%, transparent) !important;
81
+ --code-background-fill: #e9e9ea !important;
82
+
83
+ --input-background-fill: #ffffff !important;
84
+ --input-background-fill-hover: #ffffff !important;
85
+ --input-background-fill-focus: #ffffff !important;
86
+ --input-border-color: color-mix(in srgb, #1d1f20 16%, transparent) !important;
87
+ --input-border-color-hover: #5980a6 !important;
88
+ --input-border-color-focus: #5980a6 !important;
89
+ --input-placeholder-color: color-mix(in srgb, #1d1f20 40%, transparent) !important;
90
+
91
+ --checkbox-background-color: #ffffff !important;
92
+ --checkbox-background-color-hover: #ffffff !important;
93
+ --checkbox-background-color-focus: #ffffff !important;
94
+ --checkbox-background-color-selected: #5980a6 !important;
95
+ --checkbox-border-color: color-mix(in srgb, #1d1f20 16%, transparent) !important;
96
+ --checkbox-border-color-hover: #5980a6 !important;
97
+ --checkbox-border-color-focus: #5980a6 !important;
98
+ --checkbox-border-color-selected: #5980a6 !important;
99
+ --checkbox-border-radius: 2px !important;
100
+ --checkbox-label-background-fill: transparent !important;
101
+ --checkbox-label-background-fill-hover: transparent !important;
102
+ --checkbox-label-background-fill-selected: transparent !important;
103
+ --checkbox-label-border-color: transparent !important;
104
+ --checkbox-label-border-color-hover: transparent !important;
105
+ --checkbox-label-border-color-selected: transparent !important;
106
+ --checkbox-label-text-color: #1d1f20 !important;
107
+ --checkbox-label-text-color-selected: #1d1f20 !important;
108
+
109
+ --error-background-fill: color-mix(in srgb, oklch(0.52 0.14 27) 6%, transparent) !important;
110
+ --error-border-color: oklch(0.52 0.14 27) !important;
111
+ --error-text-color: oklch(0.52 0.14 27) !important;
112
+ --error-icon-color: oklch(0.52 0.14 27) !important;
113
+
114
+ --table-border-color: color-mix(in srgb, #1d1f20 16%, transparent) !important;
115
+ --table-even-background-fill: transparent !important;
116
+ --table-odd-background-fill: transparent !important;
117
+ --table-row-focus: color-mix(in srgb, #5980a6 10%, transparent) !important;
118
+ --table-text-color: #1d1f20 !important;
119
+
120
+ --button-primary-background-fill: #5980a6 !important;
121
+ --button-primary-background-fill-hover: #597ea3 !important;
122
+ --button-primary-border-color: #5980a6 !important;
123
+ --button-primary-border-color-hover: #597ea3 !important;
124
+ --button-primary-text-color: #f2f2f3 !important;
125
+ --button-primary-text-color-hover: #f2f2f3 !important;
126
+ --button-secondary-background-fill: transparent !important;
127
+ --button-secondary-background-fill-hover: color-mix(in srgb, #1d1f20 7%, transparent) !important;
128
+ --button-secondary-border-color: color-mix(in srgb, #1d1f20 16%, transparent) !important;
129
+ --button-secondary-border-color-hover: color-mix(in srgb, #1d1f20 30%, transparent) !important;
130
+ --button-secondary-text-color: #1d1f20 !important;
131
+ --button-secondary-text-color-hover: #1d1f20 !important;
132
+ --button-cancel-background-fill: transparent !important;
133
+ --button-cancel-background-fill-hover: color-mix(in srgb, #1d1f20 7%, transparent) !important;
134
+ --button-cancel-border-color: color-mix(in srgb, #1d1f20 16%, transparent) !important;
135
+ --button-cancel-text-color: #1d1f20 !important;
136
+
137
+ --slider-color: #5980a6 !important;
138
+ --loader-color: #5980a6 !important;
139
+ --accordion-text-color: #1d1f20 !important;
140
+ --shadow-drop: none !important;
141
+ --shadow-drop-lg: none !important;
142
+ }
143
+
144
+ /* ── base ─────────────────────────────────────────────────────────────── */
145
+ body, .gradio-container {
146
+ background: var(--color-bg) !important;
147
+ color: var(--color-text) !important;
148
+ font-family: var(--font-body) !important;
149
+ }
150
+ .gradio-container {
151
+ max-width: none !important;
152
+ min-height: 100vh;
153
+ padding: 0 !important;
154
+ }
155
+ .gradio-container footer,
156
+ .gradio-container .footer,
157
+ .gradio-container .built-with {
158
+ display: none !important;
159
+ }
160
+ .gradio-container * { box-sizing: border-box; }
161
+ .gradio-container h1, .gradio-container h2, .gradio-container h3, .gradio-container h4 {
162
+ font-family: var(--font-heading);
163
+ font-weight: 600;
164
+ letter-spacing: -0.01em;
165
+ margin: 0;
166
+ }
167
+ .gradio-container label, .gradio-container .label-wrap span { color: var(--color-text) !important; }
168
+ .gradio-container .info, .gradio-container .prose, .gradio-container p { color: var(--color-muted) !important; }
169
+ .mono {
170
+ font: 500 10.5px/1.3 var(--font-mono);
171
+ letter-spacing: .1em;
172
+ text-transform: uppercase;
173
+ color: var(--color-muted-2);
174
+ }
175
+ .num { font: 500 12px/1 var(--font-mono); color: var(--color-text); }
176
+
177
+ /* ── blueprint frame (registration-marked wireframe objects) ────────────── */
178
+ .blueprint { position: relative; border: 1px solid var(--color-divider); }
179
+ .blueprint > .corner { position: absolute; width: 11px; height: 11px; color: color-mix(in srgb, var(--color-text) 55%, transparent); }
180
+ .blueprint > .corner::before, .blueprint > .corner::after { content: ""; position: absolute; background: currentColor; }
181
+ .blueprint > .corner::before { left: 5px; top: 0; width: 1px; height: 100%; }
182
+ .blueprint > .corner::after { top: 5px; left: 0; width: 100%; height: 1px; }
183
+ .blueprint > .corner.tl { top: -6px; left: -6px; }
184
+ .blueprint > .corner.tr { top: -6px; right: -6px; }
185
+ .blueprint > .corner.bl { bottom: -6px; left: -6px; }
186
+ .blueprint > .corner.br { bottom: -6px; right: -6px; }
187
+ .corner-overlay { position: absolute; inset: 0; pointer-events: none; }
188
+
189
+ /* ── shell: rail + workspace ─────────────────────────────────────────── */
190
+ .app-shell {
191
+ align-items: stretch !important;
192
+ display: flex !important;
193
+ flex-wrap: nowrap !important;
194
+ gap: 0 !important;
195
+ width: 100% !important;
196
+ min-height: 100vh !important;
197
+ }
198
+ .rail-col {
199
+ min-width: 236px !important;
200
+ max-width: 236px !important;
201
+ width: 236px !important;
202
+ flex: 0 0 236px !important;
203
+ align-self: flex-start !important;
204
+ }
205
+ .rail {
206
+ height: 100vh;
207
+ min-height: 100vh;
208
+ padding: 22px 0 18px;
209
+ border-right: 1px solid var(--color-divider);
210
+ display: flex;
211
+ flex-direction: column;
212
+ position: sticky;
213
+ top: 0;
214
+ }
215
+ .rail-brand { padding: 0 20px; }
216
+ .rail-brand .name { font: 600 25px/1 var(--font-heading); color: var(--color-text); }
217
+ .rail-kicker { padding: 0 20px 9px; margin-top: 34px; }
218
+ .rail-nav { display: flex; flex-direction: column; }
219
+ .rail-nav > *,
220
+ .rail-row-wrap {
221
+ flex: 0 0 auto !important;
222
+ }
223
+ .rail-spacer { margin-top: auto; }
224
+ .rail-plate-wrap { padding: 0 20px; }
225
+ .rail-footnote {
226
+ margin-top: 14px;
227
+ font: 500 9px/1.6 var(--font-mono);
228
+ letter-spacing: .06em;
229
+ color: color-mix(in srgb, var(--color-text) 42%, transparent);
230
+ }
231
+
232
+ .workspace-col {
233
+ min-width: 0 !important;
234
+ max-width: none !important;
235
+ padding: 0 !important;
236
+ flex: 1 1 auto !important;
237
+ width: calc(100% - 236px) !important;
238
+ }
239
+
240
+ /* rail row (overlay: visible .rr under an invisible full-size button) */
241
+ .rail-row-wrap { position: relative; }
242
+ .rail-row-wrap .rail-row-click {
243
+ position: absolute !important; inset: 0 !important; z-index: 2;
244
+ min-height: 0 !important; height: 100% !important; width: 100% !important;
245
+ padding: 0 !important; margin: 0 !important; border: 0 !important;
246
+ background: transparent !important; box-shadow: none !important;
247
+ opacity: 0 !important; cursor: pointer;
248
+ }
249
+ .rail-row-wrap .rail-row-click:disabled { cursor: default; }
250
+ .rr { display: flex; align-items: center; gap: 11px; padding: 9px 20px 9px 17px; border-left: 3px solid transparent; font-size: 13.5px; }
251
+ .rr .rn { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border: 1px solid var(--color-divider); font: 500 10.5px/1 var(--font-mono); }
252
+ .rr .lb { flex: 1; }
253
+ .rr .st { font: 500 9px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--color-muted-2); }
254
+ .rr.done .rn { border-color: var(--color-accent); color: var(--color-accent-700); }
255
+ .rr.done .st { color: var(--color-accent-700); }
256
+ .rr.on { border-left-color: var(--color-accent); background: var(--color-accent-100); }
257
+ .rr.on .lb { font-weight: 600; }
258
+ .rr.on .rn { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }
259
+ .rr.on .st { color: var(--color-accent-700); }
260
+ .rr.next { background: color-mix(in srgb, var(--color-text) 4%, transparent); }
261
+ .rr.next .rn { border-color: var(--color-accent); color: var(--color-accent-700); }
262
+ .rr.next .st { color: var(--color-accent-700); }
263
+ .rr.off { opacity: .42; }
264
+
265
+ /* run-state plate */
266
+ .plate { padding: 12px 13px; display: flex; flex-direction: column; gap: 8px; }
267
+ .kv { display: flex; justify-content: space-between; gap: 10px; }
268
+ .kv span:first-child { font: 500 9.5px/1.3 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--color-muted-2); }
269
+ .kv .accent { color: var(--color-accent-700) !important; }
270
+ .kv .error { color: var(--color-error) !important; }
271
+ .kv .muted { color: var(--color-muted) !important; }
272
+ /* plain-text-key kv row (paper-faithful defaults, etc. — no mono kicker) */
273
+ .kv-plain { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--color-row-rule); font-size: 12.5px; }
274
+ .kv-plain.last { border-bottom: none; }
275
+
276
+ /* ── topbar / page head / action bar ─────────────────────────────────── */
277
+ .topbar-host {
278
+ position: relative;
279
+ display: block !important;
280
+ padding: 0 !important;
281
+ gap: 0 !important;
282
+ }
283
+ .topbar-host > .block:first-child { width: 100% !important; }
284
+ .topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 132px 13px 30px; border-bottom: 1px solid var(--color-divider); }
285
+ .intro-open-btn {
286
+ position: absolute !important;
287
+ right: 30px;
288
+ top: 8px;
289
+ z-index: 5;
290
+ }
291
+ .intro-open-btn button {
292
+ font-size: 11.5px !important;
293
+ min-height: 28px !important;
294
+ padding: 0 8px !important;
295
+ }
296
+ .pghd { padding: 26px 30px 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
297
+ .pghd h2 { font-size: 34px; line-height: 1; color: var(--color-text); }
298
+ .pghd .desc { margin-top: 5px; max-width: 640px; color: var(--color-muted); font-size: 13.5px; line-height: 1.5; }
299
+ .pghd .meta-right { text-align: right; font: 500 9.5px/1.7 var(--font-mono); color: var(--color-muted-2); white-space: nowrap; }
300
+
301
+ .stage-grid { padding: 24px 30px 0 !important; gap: 26px !important; align-items: flex-start !important; }
302
+ .stat-grid { padding: 22px 30px 0 !important; gap: 12px !important; }
303
+ .results-stat-row { padding: 22px 30px 0 !important; }
304
+ .metric-strip {
305
+ display: grid;
306
+ grid-template-columns: repeat(4, minmax(0, 1fr));
307
+ gap: 12px;
308
+ width: 100%;
309
+ }
310
+ .results-grid { padding: 26px 30px 0 !important; gap: 26px !important; align-items: flex-start !important; }
311
+
312
+ .sect { margin: 0 0 9px; padding-bottom: 8px; border-bottom: 1px solid var(--color-text); }
313
+ .sect-spaced { margin-top: 26px !important; }
314
+
315
+ .actbar-row { margin-top: auto !important; align-items: center !important; justify-content: space-between !important; flex-wrap: nowrap !important; gap: 20px !important; padding: 16px 30px !important; border-top: 1px solid var(--color-divider) !important; background: color-mix(in srgb, var(--color-text) 3%, transparent) !important; }
316
+ .actbar-note { font: 500 10px/1.4 var(--font-mono); color: var(--color-muted-2); }
317
+ .actbar-note.error { color: var(--color-error); }
318
+ .actbar-buttons {
319
+ align-items: center !important;
320
+ justify-content: flex-end !important;
321
+ flex-wrap: nowrap !important;
322
+ gap: 10px !important;
323
+ flex: 0 0 auto !important;
324
+ width: auto !important;
325
+ }
326
+ .actbar-buttons > *,
327
+ .actbar-buttons .form,
328
+ .actbar-buttons .block {
329
+ flex: 0 0 auto !important;
330
+ width: auto !important;
331
+ min-width: 0 !important;
332
+ }
333
+ .actbar-buttons button {
334
+ width: auto !important;
335
+ min-height: 36px !important;
336
+ padding: 0 16px !important;
337
+ white-space: nowrap !important;
338
+ }
339
+ .actbar-secondary-btn button { min-width: 108px !important; }
340
+ .actbar-primary-btn { position: relative; }
341
+ .actbar-primary-btn button { min-width: 170px !important; }
342
+ .actbar-primary-btn::before,
343
+ .actbar-primary-btn::after {
344
+ content: "";
345
+ position: absolute;
346
+ top: -5px;
347
+ bottom: -5px;
348
+ width: 11px;
349
+ pointer-events: none;
350
+ border-color: color-mix(in srgb, var(--color-text) 58%, transparent);
351
+ }
352
+ .actbar-primary-btn::before {
353
+ left: -5px;
354
+ border-left: 1px solid;
355
+ border-top: 1px solid;
356
+ border-bottom: 1px solid;
357
+ }
358
+ .actbar-primary-btn::after {
359
+ right: -5px;
360
+ border-right: 1px solid;
361
+ border-top: 1px solid;
362
+ border-bottom: 1px solid;
363
+ }
364
+
365
+ /* ── spec rows ────────────────────────────────────────────────────────── */
366
+ .srow-label { font-size: 12.5px; color: color-mix(in srgb, var(--color-text) 72%, transparent); padding: 10px 0; }
367
+ .srow-label .sub { display: block; font: 500 9px/1.4 var(--font-mono); text-transform: none; letter-spacing: 0; color: var(--color-muted-2); margin-top: 2px; }
368
+ .srow-control { padding: 3px 0 !important; }
369
+ .srow-row { border-top: 1px solid var(--color-row-rule) !important; align-items: center !important; }
370
+ .srow-row.first { border-top: none !important; }
371
+ .srow-row.last { border-bottom: 1px solid var(--color-row-rule) !important; }
372
+ .srow-value-row { justify-content: space-between !important; align-items: center !important; gap: 10px !important; flex-wrap: nowrap !important; }
373
+ .srow-value-row > *:first-child { flex: 1 1 auto !important; min-width: 0 !important; overflow: hidden !important; }
374
+ .srow-value-row > *:first-child .num { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
375
+ .srow-value-row > *:last-child { flex: none !important; }
376
+ .section-heading-row { align-items: baseline !important; justify-content: space-between !important; gap: 8px !important; margin-bottom: 11px !important; }
377
+ .field-pair { gap: 14px !important; align-items: flex-start !important; }
378
+ .field-pair > * { max-width: none !important; }
379
+ .field-label {
380
+ margin-bottom: 6px;
381
+ color: var(--color-muted);
382
+ font-size: 12.5px;
383
+ line-height: 1.2;
384
+ }
385
+ .static-field {
386
+ min-height: 34px;
387
+ display: flex;
388
+ align-items: center;
389
+ padding: 0 11px;
390
+ background: #fff;
391
+ border: 1px solid var(--color-divider);
392
+ border-radius: var(--radius-md);
393
+ font-size: 14px;
394
+ color: var(--color-text);
395
+ }
396
+
397
+ /* ── stat / metric plates ─────────────────────────────────────────────── */
398
+ .stat { padding: 13px 14px; }
399
+ .stat .v { font-family: var(--font-heading); font-weight: 600; font-size: 30px; line-height: 1; }
400
+ .stat .k { font: 500 8.5px/1.3 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--color-muted-2); margin-top: 6px; }
401
+
402
+ /* ── bars, plots, confusion matrix ───────────────────────────────────── */
403
+ .bar { flex: 1; height: 3px; background: color-mix(in srgb, var(--color-text) 15%, transparent); position: relative; }
404
+ .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--color-accent); }
405
+ .plot-slot { position: relative; background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--color-accent) 13%, transparent) 6px 7px); border: 1px solid var(--color-divider); display: flex; align-items: center; justify-content: center; }
406
+ .plot-slot span { font: 500 9px/1 var(--font-mono); background: var(--color-bg); padding: 3px 6px; text-transform: uppercase; letter-spacing: .1em; color: var(--color-muted-2); }
407
+ .cm { display: grid; grid-template-columns: repeat(var(--cm-n, 4), 1fr); gap: 2px; }
408
+ .cm > div { aspect-ratio: 1.6; display: grid; place-items: center; font: 500 11.5px/1 var(--font-mono); }
409
+
410
+ /* ── HTML tables (.tbl) ───────────────────────────────────────────────── */
411
+ .tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
412
+ .tbl th, .tbl td { border: 0 !important; }
413
+ .tbl th { font: 500 10px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; text-align: left; color: var(--color-muted-2); padding: 0 10px 6px 0; border-bottom: 1px solid var(--color-divider) !important; background: transparent !important; }
414
+ .tbl td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--color-row-rule) !important; vertical-align: baseline; }
415
+ .tbl td.n { font: 400 12px/1 var(--font-mono); }
416
+ .tbl .accent { color: var(--color-accent-700); }
417
+ .tbl .error { color: var(--color-error); }
418
+
419
+ /* ── status / error strips ───────────────────────────────────────────── */
420
+ .strip { display: flex; gap: 12px; padding: 12px 14px; align-items: flex-start; }
421
+ .strip.status { border: 1px solid var(--color-divider); }
422
+ .strip.error { border: 1px solid var(--color-error); border-left-width: 3px; background: var(--color-error-fill); }
423
+ .strip .strip-kicker { font: 500 9.5px/1.3 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
424
+ .strip.error .strip-kicker { color: var(--color-error); }
425
+ .strip .strip-body { margin-top: 4px; font-size: 12.5px; line-height: 1.5; }
426
+ .empty-note { padding: 14px 0; color: var(--color-muted); font-size: 13px; }
427
+
428
+ /* ── slots (one-line gr.File) ─────────────────────────────────────────── */
429
+ .file-slot .file-preview { border: 1px solid var(--color-divider) !important; border-radius: var(--radius-md); background: #fff; font-size: 12.5px !important; }
430
+ .file-slot .file-preview td, .file-slot .file-preview th { color: var(--color-text) !important; }
431
+ .file-slot.err .file-preview { border-color: var(--color-error) !important; }
432
+ .file-slot:has(.file-preview) label.float,
433
+ .file-slot:has(.file-preview) .icon-wrap,
434
+ .file-slot:has(.file-preview) .wrap:not(.file-preview-holder) { display: none !important; }
435
+ .file-slot .empty.large { min-height: 44px !important; padding: 8px !important; }
436
+ .file-slot .empty.large .icon { width: 20px !important; height: 20px !important; opacity: .5; }
437
+
438
+ /* ── buttons ──────────────────────────────────────────────────────────── */
439
+ .gradio-container button.primary, .gradio-container button.secondary {
440
+ border-radius: 0 !important;
441
+ font-family: var(--font-heading) !important;
442
+ font-weight: 600 !important;
443
+ box-shadow: none !important;
444
+ text-transform: none;
445
+ }
446
+ .gradio-container button.secondary {
447
+ background: transparent !important;
448
+ border: 1px solid var(--color-divider) !important;
449
+ color: var(--color-text) !important;
450
+ }
451
+ .gradio-container button.secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent) !important; }
452
+ .gradio-container button.primary {
453
+ background: var(--color-accent) !important;
454
+ border: 1px solid var(--color-accent) !important;
455
+ color: var(--color-bg) !important;
456
+ }
457
+ .gradio-container button.primary:hover { background: var(--color-accent-600) !important; }
458
+ .gradio-container button.primary:active { background: var(--color-accent-700) !important; }
459
+ .gradio-container button:disabled { opacity: .45 !important; cursor: not-allowed !important; }
460
+ .btn-ghost { min-width: 0 !important; flex: none !important; }
461
+ .btn-ghost button {
462
+ background: transparent !important; border-color: transparent !important;
463
+ color: var(--color-accent-700) !important; font-weight: 500 !important;
464
+ font-family: var(--font-body) !important; box-shadow: none !important;
465
+ min-width: 0 !important; width: auto !important; padding: 4px 8px !important;
466
+ white-space: nowrap;
467
+ }
468
+ .btn-ghost button:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent) !important; }
469
+ .btn-block button { width: 100%; }
470
+ .btn-primary-frame { position: relative; }
471
+
472
+ /* ── segmented control (gr.Radio restyled) ───────────────────────────── */
473
+ .seg-radio { border: 1px solid var(--color-divider); overflow: hidden; }
474
+ .seg-radio label { border: 0 !important; background: transparent !important; margin: 0 !important; padding: 7px 12px !important; font-size: 13px !important; flex: 1; justify-content: center !important; }
475
+ .seg-radio label + label { border-left: 1px solid var(--color-divider) !important; }
476
+ .seg-radio label:has(input:checked) { background: var(--color-accent) !important; color: var(--color-bg) !important; }
477
+ .seg-radio label:not(:has(input:checked)):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent) !important; }
478
+ .seg-radio input[type="radio"] { display: none !important; }
479
+
480
+ /* ── native form controls ─────────────────────────────────────────────── */
481
+ .gradio-container input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
482
+ .gradio-container textarea, .gradio-container select {
483
+ background: #fff !important;
484
+ color: var(--color-text) !important;
485
+ border: 1px solid var(--color-divider) !important;
486
+ border-radius: var(--radius-md) !important;
487
+ font-size: 14px !important;
488
+ text-overflow: ellipsis;
489
+ }
490
+ .gradio-container label:has(> input[type="checkbox"]),
491
+ .gradio-container label:has(> span > input[type="checkbox"]) {
492
+ border: none !important;
493
+ background: transparent !important;
494
+ box-shadow: none !important;
495
+ padding: 4px 0 !important;
496
+ min-height: 0 !important;
497
+ }
498
+ .gradio-container .block:has(> label.checkbox-container) {
499
+ border: none !important;
500
+ background: transparent !important;
501
+ box-shadow: none !important;
502
+ padding: 0 !important;
503
+ }
504
+ .gradio-container input[type="checkbox"] {
505
+ appearance: none; width: 14px; height: 14px; flex: none;
506
+ border: 1px solid var(--color-divider); background: #fff; position: relative;
507
+ border-radius: 0;
508
+ }
509
+ .gradio-container input[type="checkbox"]:checked {
510
+ background: var(--color-accent); border-color: var(--color-accent);
511
+ }
512
+ .gradio-container input[type="checkbox"]:checked::after {
513
+ content: ""; position: absolute; left: 3px; top: 6px; width: 4px; height: 1.5px;
514
+ background: #fff; transform: rotate(45deg);
515
+ }
516
+ .gradio-container input[type="checkbox"]:checked::before {
517
+ content: ""; position: absolute; left: 5px; top: 7px; width: 7px; height: 1.5px;
518
+ background: #fff; transform: rotate(-50deg);
519
+ }
520
+ .gradio-container input[type="radio"] {
521
+ appearance: none; width: 15px; height: 15px; flex: none; border-radius: 50%;
522
+ border: 1.5px solid var(--color-divider); background: #fff;
523
+ }
524
+ .gradio-container input[type="radio"]:checked {
525
+ border-color: var(--color-accent);
526
+ background: radial-gradient(circle, var(--color-accent) 0 40%, #fff 42% 100%);
527
+ }
528
+ .gradio-container input[type="range"] { accent-color: var(--color-accent); height: 3px; }
529
+ .gradio-container :focus-visible { outline: 2px solid var(--color-accent) !important; outline-offset: 2px; }
530
+
531
+ /* Gradio pulses a 2px accent border + animation around every component
532
+ whose value is currently pending ("generating"), independent of
533
+ show_progress. One action often updates several visible components at
534
+ once (a table, a note, a stat panel, …), so this reads as multiple
535
+ flashing "loading bars" appearing together — we already surface busy
536
+ state through the triggering button's own label (see app.py's `_busy`
537
+ helper), so drop Gradio's border/animation entirely rather than have it
538
+ multiply per output. */
539
+ .gradio-container .generating {
540
+ animation: none !important;
541
+ border-color: transparent !important;
542
+ border-width: 0 !important;
543
+ background: none !important;
544
+ }
545
+
546
+ /* The one deliberate loading indicator: a thin animated bar along the
547
+ bottom edge of whichever action button is currently busy. Toggled
548
+ explicitly by app.py's `_busy`/`_idle` helpers via the `is-busy` class —
549
+ never by Gradio's own per-component pending state — so exactly one of
550
+ these can ever be on screen at a time. */
551
+ /* elem_classes lands directly on the <button> tag for gr.Button (no
552
+ wrapper div) — cover both that and a wrapper div defensively. */
553
+ .is-busy, .is-busy button {
554
+ position: relative;
555
+ overflow: hidden;
556
+ }
557
+ .is-busy::after, .is-busy button::after {
558
+ content: "";
559
+ position: absolute;
560
+ left: 0; bottom: 0; height: 2px; width: 35%;
561
+ background: currentColor;
562
+ opacity: .7;
563
+ animation: workbench-busy-sweep 1.1s ease-in-out infinite;
564
+ }
565
+ @keyframes workbench-busy-sweep {
566
+ 0% { transform: translateX(-100%); }
567
+ 100% { transform: translateX(285%); }
568
+ }
569
+
570
+ /* dataframes (.tbl-like) */
571
+ .gradio-container table { color: var(--color-text) !important; font-size: 12.5px !important; }
572
+ .gradio-container thead th {
573
+ font: 500 10px/1 var(--font-mono) !important; letter-spacing: .1em; text-transform: uppercase;
574
+ color: var(--color-muted-2) !important; background: transparent !important;
575
+ border-bottom: 1px solid var(--color-divider) !important;
576
+ }
577
+ .gradio-container tbody td { border-bottom: 1px solid var(--color-row-rule) !important; }
578
+ .gradio-container .table-wrap .toolbar-container,
579
+ .gradio-container .table-wrap .cell-menu-button,
580
+ .gradio-container .table-wrap button.cell-menu,
581
+ .gradio-container .table-wrap .icon-button-wrapper { display: none !important; }
582
+
583
+ /* accordion */
584
+ .gradio-container .label-wrap { color: var(--color-text) !important; }
585
+
586
+ /* ── first-open introduction ─────────────────────────────────────────── */
587
+ #intro {
588
+ position: fixed !important;
589
+ inset: 0 !important;
590
+ z-index: 60 !important;
591
+ min-height: 100vh !important;
592
+ display: grid !important;
593
+ place-items: center !important;
594
+ padding: 24px !important;
595
+ background: rgba(29, 31, 32, .6) !important;
596
+ border: 0 !important;
597
+ }
598
+ #intro[style*="display: none"] {
599
+ display: none !important;
600
+ }
601
+ #intro > .form,
602
+ #intro .form {
603
+ display: contents !important;
604
+ }
605
+ .intro-card {
606
+ position: relative;
607
+ width: min(556px, calc(100vw - 48px)) !important;
608
+ background: var(--color-bg) !important;
609
+ border: 1px solid rgba(29,31,32,.18) !important;
610
+ padding: 26px 28px 20px !important;
611
+ box-shadow: 0 18px 44px rgba(0,0,0,.18) !important;
612
+ }
613
+ .intro-card::before,
614
+ .intro-card::after {
615
+ content: "";
616
+ position: absolute;
617
+ top: -6px;
618
+ bottom: -6px;
619
+ width: 11px;
620
+ pointer-events: none;
621
+ border-color: color-mix(in srgb, var(--color-text) 55%, transparent);
622
+ }
623
+ .intro-card::before {
624
+ left: -6px;
625
+ border-left: 1px solid;
626
+ border-top: 1px solid;
627
+ border-bottom: 1px solid;
628
+ }
629
+ .intro-card::after {
630
+ right: -6px;
631
+ border-right: 1px solid;
632
+ border-top: 1px solid;
633
+ border-bottom: 1px solid;
634
+ }
635
+ .intro-card-page {
636
+ gap: 0 !important;
637
+ }
638
+ .intro-step {
639
+ font: 500 10px/1.3 var(--font-mono);
640
+ letter-spacing: .1em;
641
+ text-transform: uppercase;
642
+ color: var(--color-accent-700);
643
+ }
644
+ .intro-card h4 {
645
+ margin: 10px 0 10px;
646
+ font: 600 27px/1 var(--font-heading);
647
+ color: var(--color-text);
648
+ }
649
+ .intro-card p {
650
+ margin: 0 0 10px;
651
+ font-size: 13.5px;
652
+ line-height: 1.55;
653
+ color: color-mix(in srgb, var(--color-text) 74%, transparent) !important;
654
+ }
655
+ .intro-stage-list {
656
+ display: flex;
657
+ flex-direction: column;
658
+ gap: 8px;
659
+ margin: 8px 0 6px;
660
+ }
661
+ .intro-stage-list div {
662
+ display: grid;
663
+ grid-template-columns: 28px minmax(0, 1fr);
664
+ gap: 8px;
665
+ align-items: baseline;
666
+ font-size: 13px;
667
+ }
668
+ .intro-stage-list em {
669
+ font: 500 10px/1 var(--font-mono);
670
+ color: var(--color-accent-700);
671
+ font-style: normal;
672
+ }
673
+ .intro-card-foot {
674
+ align-items: center !important;
675
+ justify-content: space-between !important;
676
+ gap: 12px 16px !important;
677
+ margin-top: 16px !important;
678
+ padding-top: 14px !important;
679
+ border-top: 1px solid var(--color-divider) !important;
680
+ flex-wrap: wrap !important;
681
+ }
682
+ .intro-card-foot > *:first-child {
683
+ flex: 1 1 auto !important;
684
+ min-width: 0 !important;
685
+ max-width: 100% !important;
686
+ overflow-wrap: anywhere;
687
+ }
688
+ .intro-card-actions {
689
+ align-items: center !important;
690
+ justify-content: flex-end !important;
691
+ flex: 1 0 220px !important;
692
+ gap: 12px !important;
693
+ flex-wrap: nowrap !important;
694
+ width: auto !important;
695
+ margin-left: auto !important;
696
+ }
697
+ .intro-card-actions > * {
698
+ flex: 0 0 auto !important;
699
+ width: auto !important;
700
+ }
701
+ .intro-card-actions button {
702
+ min-height: 30px !important;
703
+ padding: 0 12px !important;
704
+ font-size: 12.5px !important;
705
+ white-space: normal !important;
706
+ line-height: 1.15 !important;
707
+ }
708
+ .intro-dots {
709
+ display: flex;
710
+ align-items: center;
711
+ gap: 5px;
712
+ flex: 0 0 auto;
713
+ }
714
+ .intro-dots i {
715
+ width: 8px;
716
+ height: 8px;
717
+ display: block;
718
+ background: color-mix(in srgb, var(--color-text) 18%, transparent);
719
+ }
720
+ .intro-dots i.on {
721
+ background: var(--color-accent);
722
+ }
723
+
724
+ /* ── responsive ───────────────────────────────────────────────────────── */
725
+ @media (max-width: 1000px) {
726
+ .app-shell { display: block !important; }
727
+ .rail-col { min-width: 100% !important; max-width: 100% !important; }
728
+ .rail { position: relative; min-height: auto; border-right: 0; border-bottom: 1px solid var(--color-divider); }
729
+ .stage-grid, .results-grid { grid-template-columns: 1fr !important; }
730
+ }
731
+ @media (max-width: 620px) {
732
+ .pghd h2 { font-size: 26px; }
733
+ .stat-grid, .metric-strip { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
734
+ }
735
+ """
e2e-tests/.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ target/
2
+ .mvn/apache-maven-*/
3
+ .mvn/apache-maven-*.zip
e2e-tests/.mvn/wrapper/maven-wrapper.properties ADDED
@@ -0,0 +1 @@
 
 
1
+ distributionUrl=https://archive.apache.org/dist/maven/maven-3/3.9.11/binaries/apache-maven-3.9.11-bin.zip
e2e-tests/mvnw ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ BASE_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
5
+ MAVEN_VERSION="3.9.11"
6
+ MAVEN_DIR="$BASE_DIR/.mvn/apache-maven-$MAVEN_VERSION"
7
+ MAVEN_ZIP="$BASE_DIR/.mvn/apache-maven-$MAVEN_VERSION-bin.zip"
8
+ MAVEN_URL="https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.zip"
9
+
10
+ if [ ! -x "$MAVEN_DIR/bin/mvn" ]; then
11
+ mkdir -p "$BASE_DIR/.mvn"
12
+ if [ ! -f "$MAVEN_ZIP" ]; then
13
+ curl -fsSL "$MAVEN_URL" -o "$MAVEN_ZIP"
14
+ fi
15
+ (cd "$BASE_DIR/.mvn" && unzip -q -o "$MAVEN_ZIP")
16
+ fi
17
+
18
+ exec "$MAVEN_DIR/bin/mvn" "$@"
e2e-tests/pom.xml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns="http://maven.apache.org/POM/4.0.0"
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+ <modelVersion>4.0.0</modelVersion>
6
+
7
+ <groupId>org.biolmnet</groupId>
8
+ <artifactId>biolmnet-workbench-e2e</artifactId>
9
+ <version>0.1.0-SNAPSHOT</version>
10
+ <packaging>jar</packaging>
11
+
12
+ <properties>
13
+ <maven.compiler.release>17</maven.compiler.release>
14
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15
+ <cucumber.version>7.30.0</cucumber.version>
16
+ <junit.platform.version>1.14.1</junit.platform.version>
17
+ <selenium.version>4.39.0</selenium.version>
18
+ </properties>
19
+
20
+ <dependencies>
21
+ <dependency>
22
+ <groupId>io.cucumber</groupId>
23
+ <artifactId>cucumber-java</artifactId>
24
+ <version>${cucumber.version}</version>
25
+ <scope>test</scope>
26
+ </dependency>
27
+ <dependency>
28
+ <groupId>io.cucumber</groupId>
29
+ <artifactId>cucumber-junit-platform-engine</artifactId>
30
+ <version>${cucumber.version}</version>
31
+ <scope>test</scope>
32
+ </dependency>
33
+ <dependency>
34
+ <groupId>org.junit.platform</groupId>
35
+ <artifactId>junit-platform-suite</artifactId>
36
+ <version>${junit.platform.version}</version>
37
+ <scope>test</scope>
38
+ </dependency>
39
+ <dependency>
40
+ <groupId>org.junit.jupiter</groupId>
41
+ <artifactId>junit-jupiter-api</artifactId>
42
+ <version>5.14.1</version>
43
+ <scope>test</scope>
44
+ </dependency>
45
+ <dependency>
46
+ <groupId>org.seleniumhq.selenium</groupId>
47
+ <artifactId>selenium-java</artifactId>
48
+ <version>${selenium.version}</version>
49
+ <scope>test</scope>
50
+ </dependency>
51
+ </dependencies>
52
+
53
+ <build>
54
+ <plugins>
55
+ <plugin>
56
+ <groupId>org.apache.maven.plugins</groupId>
57
+ <artifactId>maven-surefire-plugin</artifactId>
58
+ <version>3.5.4</version>
59
+ <configuration>
60
+ <includes>
61
+ <include>**/*Test.java</include>
62
+ </includes>
63
+ <systemPropertyVariables>
64
+ <cucumber.plugin>pretty, html:target/cucumber-report.html, json:target/cucumber-report.json</cucumber.plugin>
65
+ <cucumber.filter.tags>${cucumber.filter.tags}</cucumber.filter.tags>
66
+ </systemPropertyVariables>
67
+ </configuration>
68
+ </plugin>
69
+ </plugins>
70
+ </build>
71
+ </project>
e2e-tests/src/test/java/org/biolmnet/e2e/RunCucumberTest.java ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.biolmnet.e2e;
2
+
3
+ import static io.cucumber.junit.platform.engine.Constants.GLUE_PROPERTY_NAME;
4
+ import static io.cucumber.junit.platform.engine.Constants.PLUGIN_PROPERTY_NAME;
5
+
6
+ import org.junit.platform.suite.api.ConfigurationParameter;
7
+ import org.junit.platform.suite.api.IncludeEngines;
8
+ import org.junit.platform.suite.api.SelectClasspathResource;
9
+ import org.junit.platform.suite.api.Suite;
10
+
11
+ @Suite
12
+ @IncludeEngines("cucumber")
13
+ @SelectClasspathResource("features")
14
+ @ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "org.biolmnet.e2e")
15
+ @ConfigurationParameter(
16
+ key = PLUGIN_PROPERTY_NAME,
17
+ value = "pretty, html:target/cucumber-report.html, json:target/cucumber-report.json")
18
+ public class RunCucumberTest {
19
+ }
e2e-tests/src/test/java/org/biolmnet/e2e/config/TestConfig.java ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.biolmnet.e2e.config;
2
+
3
+ public final class TestConfig {
4
+ private TestConfig() {
5
+ }
6
+
7
+ public static String baseUrl() {
8
+ return System.getProperty("baseUrl", "http://127.0.0.1:7860");
9
+ }
10
+
11
+ public static boolean headless() {
12
+ return Boolean.parseBoolean(System.getProperty("headless", "false"));
13
+ }
14
+ }
e2e-tests/src/test/java/org/biolmnet/e2e/driver/DriverFactory.java ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.biolmnet.e2e.driver;
2
+
3
+ import org.biolmnet.e2e.config.TestConfig;
4
+ import org.openqa.selenium.WebDriver;
5
+ import org.openqa.selenium.chrome.ChromeDriver;
6
+ import org.openqa.selenium.chrome.ChromeOptions;
7
+
8
+ public final class DriverFactory {
9
+ private static final ThreadLocal<WebDriver> DRIVER = new ThreadLocal<>();
10
+
11
+ private DriverFactory() {
12
+ }
13
+
14
+ public static WebDriver getDriver() {
15
+ WebDriver driver = DRIVER.get();
16
+ if (driver == null) {
17
+ ChromeOptions options = new ChromeOptions();
18
+ options.addArguments("--window-size=1440,1100");
19
+ if (TestConfig.headless()) {
20
+ options.addArguments("--headless=new");
21
+ }
22
+ driver = new ChromeDriver(options);
23
+ DRIVER.set(driver);
24
+ }
25
+ return driver;
26
+ }
27
+
28
+ public static void quitDriver() {
29
+ WebDriver driver = DRIVER.get();
30
+ if (driver != null) {
31
+ driver.quit();
32
+ DRIVER.remove();
33
+ }
34
+ }
35
+ }
e2e-tests/src/test/java/org/biolmnet/e2e/pages/BasePage.java ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.biolmnet.e2e.pages;
2
+
3
+ import java.time.Duration;
4
+
5
+ import org.openqa.selenium.By;
6
+ import org.openqa.selenium.WebDriver;
7
+ import org.openqa.selenium.WebElement;
8
+ import org.openqa.selenium.support.ui.ExpectedConditions;
9
+ import org.openqa.selenium.support.ui.WebDriverWait;
10
+
11
+ public class BasePage {
12
+ protected final WebDriver driver;
13
+ protected final WebDriverWait wait;
14
+
15
+ public BasePage(WebDriver driver) {
16
+ this.driver = driver;
17
+ this.wait = new WebDriverWait(driver, Duration.ofSeconds(20));
18
+ }
19
+
20
+ protected WebElement visible(By locator) {
21
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(locator));
22
+ }
23
+ }
e2e-tests/src/test/java/org/biolmnet/e2e/pages/WorkbenchPage.java ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.biolmnet.e2e.pages;
2
+
3
+ import org.openqa.selenium.By;
4
+ import org.openqa.selenium.WebDriver;
5
+ import org.openqa.selenium.WebElement;
6
+
7
+ public class WorkbenchPage extends BasePage {
8
+ private static final By APP_HEADER = By.cssSelector("#app-header");
9
+ private static final By NAV_DATA = By.cssSelector("#nav-data");
10
+ private static final By NAV_TRAIN = By.cssSelector("#nav-train");
11
+ private static final By NAV_EXPORT = By.cssSelector("#nav-export");
12
+ private static final By NAV_PREDICT = By.cssSelector("#nav-predict");
13
+ private static final By NAV_RESULTS = By.cssSelector("#nav-results");
14
+ private static final By PAGE_DATA = By.cssSelector("#page-data");
15
+ private static final By PAGE_TRAIN = By.cssSelector("#page-train");
16
+ private static final By PAGE_EXPORT = By.cssSelector("#page-export");
17
+ private static final By PAGE_PREDICT = By.cssSelector("#page-predict");
18
+ private static final By PAGE_RESULTS = By.cssSelector("#page-results");
19
+
20
+ public WorkbenchPage(WebDriver driver) {
21
+ super(driver);
22
+ }
23
+
24
+ public void open(String baseUrl) {
25
+ driver.get(baseUrl);
26
+ }
27
+
28
+ public boolean headerIsVisible() {
29
+ return visible(APP_HEADER).isDisplayed();
30
+ }
31
+
32
+ public boolean sidebarWorkflowIsVisible() {
33
+ return visible(NAV_DATA).isDisplayed()
34
+ && visible(NAV_TRAIN).isDisplayed()
35
+ && visible(NAV_EXPORT).isDisplayed()
36
+ && visible(NAV_PREDICT).isDisplayed()
37
+ && visible(NAV_RESULTS).isDisplayed();
38
+ }
39
+
40
+ public boolean onlyDataPageIsVisible() {
41
+ visible(PAGE_DATA);
42
+ return isDisplayed(PAGE_DATA)
43
+ && !isDisplayed(PAGE_TRAIN)
44
+ && !isDisplayed(PAGE_EXPORT)
45
+ && !isDisplayed(PAGE_PREDICT)
46
+ && !isDisplayed(PAGE_RESULTS);
47
+ }
48
+
49
+ private boolean isDisplayed(By locator) {
50
+ return driver.findElements(locator).stream().anyMatch(WebElement::isDisplayed);
51
+ }
52
+ }
e2e-tests/src/test/java/org/biolmnet/e2e/steps/ApplicationLaunchSteps.java ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.biolmnet.e2e.steps;
2
+
3
+ import static org.junit.jupiter.api.Assertions.assertTrue;
4
+
5
+ import io.cucumber.java.en.Given;
6
+ import io.cucumber.java.en.Then;
7
+ import io.cucumber.java.en.When;
8
+ import org.biolmnet.e2e.config.TestConfig;
9
+ import org.biolmnet.e2e.driver.DriverFactory;
10
+ import org.biolmnet.e2e.pages.WorkbenchPage;
11
+
12
+ public class ApplicationLaunchSteps {
13
+ private WorkbenchPage workbenchPage;
14
+
15
+ @Given("the BioLM-NET Workbench app is running")
16
+ public void theWorkbenchAppIsRunning() {
17
+ workbenchPage = new WorkbenchPage(DriverFactory.getDriver());
18
+ }
19
+
20
+ @When("I open the BioLM-NET Workbench")
21
+ public void iOpenTheWorkbench() {
22
+ workbenchPage.open(TestConfig.baseUrl());
23
+ }
24
+
25
+ @Then("the application header is visible")
26
+ public void theApplicationHeaderIsVisible() {
27
+ assertTrue(workbenchPage.headerIsVisible(), "Expected the BioLM-NET Workbench header to be visible.");
28
+ }
29
+
30
+ @Then("the workflow sidebar is visible")
31
+ public void theWorkflowSidebarIsVisible() {
32
+ assertTrue(workbenchPage.sidebarWorkflowIsVisible(), "Expected all workflow navigation buttons to be visible.");
33
+ }
34
+
35
+ @Then("only the Data & Priors workspace is visible")
36
+ public void onlyTheDataAndPriorsWorkspaceIsVisible() {
37
+ assertTrue(workbenchPage.onlyDataPageIsVisible(), "Expected only the Data & Priors workspace to be visible.");
38
+ }
39
+ }
e2e-tests/src/test/java/org/biolmnet/e2e/support/Hooks.java ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.biolmnet.e2e.support;
2
+
3
+ import io.cucumber.java.After;
4
+ import io.cucumber.java.Scenario;
5
+ import java.io.IOException;
6
+ import java.nio.file.Files;
7
+ import java.nio.file.Path;
8
+ import org.biolmnet.e2e.driver.DriverFactory;
9
+ import org.openqa.selenium.OutputType;
10
+ import org.openqa.selenium.TakesScreenshot;
11
+ import org.openqa.selenium.WebDriver;
12
+
13
+ public class Hooks {
14
+ @After
15
+ public void afterScenario(Scenario scenario) throws IOException {
16
+ WebDriver driver = DriverFactory.getDriver();
17
+ if (scenario.isFailed() && driver instanceof TakesScreenshot screenshotDriver) {
18
+ Path screenshotDir = Path.of("target", "screenshots");
19
+ Files.createDirectories(screenshotDir);
20
+ byte[] screenshot = screenshotDriver.getScreenshotAs(OutputType.BYTES);
21
+ Path screenshotPath = screenshotDir.resolve(scenario.getName().replaceAll("[^A-Za-z0-9]+", "-") + ".png");
22
+ Files.write(screenshotPath, screenshot);
23
+ scenario.attach(screenshot, "image/png", screenshotPath.toString());
24
+ }
25
+ DriverFactory.quitDriver();
26
+ }
27
+ }
e2e-tests/src/test/resources/features/application_launch.feature ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @smoke
2
+ Feature: Application launch
3
+
4
+ @E2E-001
5
+ Scenario: Workbench launches
6
+ Given the BioLM-NET Workbench app is running
7
+ When I open the BioLM-NET Workbench
8
+ Then the application header is visible
9
+ And the workflow sidebar is visible
10
+
11
+ @E2E-002
12
+ Scenario: Data and Priors workspace is visible by default
13
+ Given the BioLM-NET Workbench app is running
14
+ When I open the BioLM-NET Workbench
15
+ Then only the Data & Priors workspace is visible
tests/test_core.py CHANGED
@@ -128,6 +128,35 @@ def test_model_forward_probabilistic_shape() -> None:
128
  )
129
 
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  def test_training_artifact_roundtrip(tmp_path) -> None:
132
  workspace = _tiny_workspace()
133
  result = train(
@@ -161,6 +190,39 @@ def test_training_artifact_roundtrip(tmp_path) -> None:
161
  )
162
 
163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  def test_zerogpu_duration_estimator_is_bounded_and_scales() -> None:
165
  from app import estimate_training_duration
166
 
 
128
  )
129
 
130
 
131
+ def test_duplicate_embedding_rows_do_not_break_pathway_attachment() -> None:
132
+ branch = BranchPriors(
133
+ input_genes=["A", "B"],
134
+ hidden_genes=["A", "B", "C"],
135
+ biological_mask=np.ones((2, 3), dtype=np.float32),
136
+ )
137
+ embeddings = pd.DataFrame(
138
+ np.arange(16, dtype=np.float32).reshape(4, 4),
139
+ index=["A", "B", "B", "C"],
140
+ )
141
+ pathway_mapping = pd.DataFrame(
142
+ {
143
+ "SYMBOL": ["A", "B", "C"],
144
+ "PathwayID": ["hsa1", "hsa1", "hsa2"],
145
+ }
146
+ )
147
+
148
+ attach_embeddings_and_pathways(
149
+ branch,
150
+ embeddings,
151
+ pathway_mapping,
152
+ precomputed_significant=True,
153
+ )
154
+
155
+ assert branch.embeddings.shape[0] == len(branch.hidden_genes)
156
+ assert branch.biological_mask.shape[1] == len(branch.hidden_genes)
157
+ assert branch.pathway_mask.shape[0] == len(branch.hidden_genes)
158
+
159
+
160
  def test_training_artifact_roundtrip(tmp_path) -> None:
161
  workspace = _tiny_workspace()
162
  result = train(
 
190
  )
191
 
192
 
193
+ def test_prediction_can_score_prepared_workspace_without_uploads() -> None:
194
+ from app import run_prediction
195
+
196
+ workspace = _tiny_workspace()
197
+ result = train(
198
+ workspace,
199
+ Hyperparameters(
200
+ epochs=3,
201
+ batch_size=8,
202
+ projection_dim=4,
203
+ fusion_dim=3,
204
+ dropout=0.0,
205
+ early_stopping_patience=3,
206
+ ),
207
+ )
208
+
209
+ _, status, output, _, download_path, predict_meta = run_prediction(
210
+ result.bundle,
211
+ workspace,
212
+ None,
213
+ False,
214
+ True,
215
+ None,
216
+ None,
217
+ {},
218
+ )
219
+
220
+ assert "Predicted 48 samples" in status
221
+ assert len(output) == len(workspace.labels)
222
+ assert download_path is not None
223
+ assert predict_meta["n_samples"] == len(workspace.labels)
224
+
225
+
226
  def test_zerogpu_duration_estimator_is_bounded_and_scales() -> None:
227
  from app import estimate_training_duration
228