Cyprien
Put the loading indicator beside Revision
6a2ee52
Raw
History Blame Contribute Delete
1.8 kB
from datetime import datetime
from .config import CALLER_TURNS, DATASET_REPO, ORG, stamp
HEADER = f"""
# Breakdown risk
Classifies the **caller's turns** of an inbound call as `risk` — the vehicle is
probably off the road, the call needs a tow truck or an urgent slot — or
`no_risk` — the customer can still drive, a normal appointment will do.
<sub>Models published by `train.py` in the `{ORG}` organisation · scored on the
test split of [`{DATASET_REPO}`](https://huggingface.co/datasets/{DATASET_REPO})
· only the last {CALLER_TURNS} turns are read · times in Paris time</sub>
"""
# Callers speak French, so the sample transcript stays French, like the dataset.
PLACEHOLDER = "Oui bonjour.\nMa voiture ne démarre plus depuis ce matin."
TRANSCRIPT_INFO = (
f"One turn per line. Only the last {CALLER_TURNS} are classified. "
"⇧ Enter or ⌘/Ctrl + Enter to classify."
)
NO_MODEL = "No model selected."
LOADING = "Loading the model"
SCORING = "Classifying the test split"
CLASSIFY = "Classify"
EVALUATE = "Evaluate on the test split"
WARMING = "Downloading the model…"
WARM_FAILED = "Could not load that revision"
# The indicator beside Revision is narrow, so it words the same states shorter.
STATUS_LOADING = "Loading…"
STATUS_FAILED = "Failed"
def pushed_at(when: datetime | None) -> str:
"""Line under the pickers: when the selected repo was last touched."""
if when is None:
return ""
return f"<sub>Repo last updated {stamp(when)}</sub>"
def status_line(text: str) -> str:
"""The indicator beside Revision: what the picked model is doing."""
return f"<sub>{text}</sub>"
def status_ready(ms: float) -> str:
"""Only knowable once the weights are here, which is why it reads as loading."""
return f"Ready · {ms:.0f} ms"