Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -151,6 +151,16 @@ CSS = """
|
|
| 151 |
color: var(--ink);
|
| 152 |
}
|
| 153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
.guide-grid {
|
| 155 |
display: grid;
|
| 156 |
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
@@ -255,6 +265,15 @@ CSS = """
|
|
| 255 |
box-shadow: var(--shadow);
|
| 256 |
}
|
| 257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
.explain-grid {
|
| 259 |
display: grid;
|
| 260 |
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
@@ -569,29 +588,21 @@ def _decorate_valid_rows(valid_rows: list[dict[str, Any]]) -> list[dict[str, Any
|
|
| 569 |
|
| 570 |
def _build_summary(query_text: str, valid_rows: list[dict[str, Any]], invalid_rows: list[dict[str, Any]], warning: str | None) -> str:
|
| 571 |
best = valid_rows[0] if valid_rows else None
|
| 572 |
-
score_range = None
|
| 573 |
-
if valid_rows:
|
| 574 |
-
raw_scores = [float(row["score"]) for row in valid_rows]
|
| 575 |
-
score_range = max(raw_scores) - min(raw_scores)
|
| 576 |
chunks = [
|
| 577 |
-
"###
|
| 578 |
-
f"-
|
| 579 |
-
f"- Assay fields serialized into `{len(query_text.split())}` words",
|
| 580 |
-
f"- Valid molecules ranked: `{len(valid_rows)}`",
|
| 581 |
-
f"- Invalid molecules rejected: `{len(invalid_rows)}`",
|
| 582 |
]
|
|
|
|
|
|
|
| 583 |
if best is not None:
|
| 584 |
chunks.append(
|
| 585 |
-
f"- Top
|
| 586 |
)
|
| 587 |
-
if score_range is not None:
|
| 588 |
-
chunks.append(f"- Score spread across this submitted list: `{score_range:.2f}` model-score units")
|
| 589 |
if warning:
|
| 590 |
chunks.append(f"- Warning: {warning}")
|
| 591 |
chunks.append("")
|
| 592 |
chunks.append(
|
| 593 |
-
"Use
|
| 594 |
-
"A candidate with `relative score 100` is the strongest item in your submitted list, not in all chemistry."
|
| 595 |
)
|
| 596 |
return "\n".join(chunks)
|
| 597 |
|
|
@@ -759,7 +770,7 @@ with gr.Blocks(title="BioAssayAlign Compatibility Explorer", analytics_enabled=F
|
|
| 759 |
gr.HTML(
|
| 760 |
f"""
|
| 761 |
<div class="metric-strip">
|
| 762 |
-
<div class="metric-card"><span>Model</span><strong>Qwen3-Embedding-0.6B compatibility scorer</strong></div>
|
| 763 |
<div class="metric-card"><span>Input contract</span><strong>1 assay definition + up to {MAX_INPUT_SMILES} candidate SMILES</strong></div>
|
| 764 |
<div class="metric-card"><span>Score semantics</span><strong>Use rank and relative score within the submitted list</strong></div>
|
| 765 |
</div>
|
|
|
|
| 151 |
color: var(--ink);
|
| 152 |
}
|
| 153 |
|
| 154 |
+
.metric-card a {
|
| 155 |
+
color: var(--ink);
|
| 156 |
+
text-decoration: none;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
.metric-card a:hover {
|
| 160 |
+
color: var(--accent-deep);
|
| 161 |
+
text-decoration: underline;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
.guide-grid {
|
| 165 |
display: grid;
|
| 166 |
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
|
|
| 265 |
box-shadow: var(--shadow);
|
| 266 |
}
|
| 267 |
|
| 268 |
+
.results-shell,
|
| 269 |
+
.results-shell *,
|
| 270 |
+
.results-shell p,
|
| 271 |
+
.results-shell li,
|
| 272 |
+
.results-shell strong,
|
| 273 |
+
.results-shell code {
|
| 274 |
+
color: var(--ink) !important;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
.explain-grid {
|
| 278 |
display: grid;
|
| 279 |
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
|
|
| 588 |
|
| 589 |
def _build_summary(query_text: str, valid_rows: list[dict[str, Any]], invalid_rows: list[dict[str, Any]], warning: str | None) -> str:
|
| 590 |
best = valid_rows[0] if valid_rows else None
|
|
|
|
|
|
|
|
|
|
|
|
|
| 591 |
chunks = [
|
| 592 |
+
"### Ranked shortlist",
|
| 593 |
+
f"- Ranked candidates: `{len(valid_rows)}`",
|
|
|
|
|
|
|
|
|
|
| 594 |
]
|
| 595 |
+
if invalid_rows:
|
| 596 |
+
chunks.append(f"- Rejected inputs: `{len(invalid_rows)}`")
|
| 597 |
if best is not None:
|
| 598 |
chunks.append(
|
| 599 |
+
f"- Top candidate: `{best['canonical_smiles']}` 路 `{best['priority_band']}` 路 relative score `{best['relative_score']:.1f}/100`"
|
| 600 |
)
|
|
|
|
|
|
|
| 601 |
if warning:
|
| 602 |
chunks.append(f"- Warning: {warning}")
|
| 603 |
chunks.append("")
|
| 604 |
chunks.append(
|
| 605 |
+
"Use **priority** and **relative score** as the decision surface. `model_score` is an internal compatibility logit and should only be compared within this submitted list."
|
|
|
|
| 606 |
)
|
| 607 |
return "\n".join(chunks)
|
| 608 |
|
|
|
|
| 770 |
gr.HTML(
|
| 771 |
f"""
|
| 772 |
<div class="metric-strip">
|
| 773 |
+
<div class="metric-card"><span>Model</span><strong><a href="https://huggingface.co/{MODEL_REPO_ID}" target="_blank" rel="noopener">Qwen3-Embedding-0.6B compatibility scorer</a></strong></div>
|
| 774 |
<div class="metric-card"><span>Input contract</span><strong>1 assay definition + up to {MAX_INPUT_SMILES} candidate SMILES</strong></div>
|
| 775 |
<div class="metric-card"><span>Score semantics</span><strong>Use rank and relative score within the submitted list</strong></div>
|
| 776 |
</div>
|