breakdown-risk-demo / app /config.py
Cyprien
Put the interface in English, and timestamps in Paris time
b42781c
Raw
History Blame Contribute Delete
643 Bytes
import os
from datetime import UTC, datetime
from zoneinfo import ZoneInfo
ORG = "bee2link"
MODEL_SEARCH = "breakdown-risk-"
DATASET_REPO = "bee2link/breakdown-risk"
CALLER_TURNS = 3
REFRESH_SECONDS = 30
TOKEN = os.environ.get("HF_TOKEN")
PARIS = ZoneInfo("Europe/Paris")
LABEL_NAMES = {"risk": "Breakdown risk", "no_risk": "No risk"}
def display(label: str) -> str:
return LABEL_NAMES.get(label, label)
def stamp(when: datetime) -> str:
"""One timestamp format everywhere, in Paris time; the Hub reports UTC."""
utc = when if when.tzinfo else when.replace(tzinfo=UTC)
return f"{utc.astimezone(PARIS):%Y-%m-%d %H:%M %Z}"