Skip to main content
src/hosting/publish_hf.py · chapter The dashboard and publishing, file 14 · 210 lines · open in the repository

What it does

Publish the project on Hugging Face (decision 0010): a dataset, a model and the dashboard. Three repos in the team’s Hugging Face organisation (common.settings.HF_OWNER, HF_REPOS): dataset calendar-effects/calendar-effects our derived tables (no prices), results and config registries model calendar-effects/big-move-model the Spark MLlib PipelineModel, its scores and charts space calendar-effects/dashboard a free static page that embeds the hosted dashboard Nothing is uploaded unless you pass —upload. Without it the script builds the three folders in data/publish/ and lists every file that would go up, so you can open them and check first.
You must be a member of the organisation with write access. Options: —owner NAME (another account or organisation), —private (create new repos as private, to look before making them public).

What is inside

  • NAMES · line 41
  • CONFIG_FILES · line 42
  • MODEL_CHARTS · line 43
  • REPLACE · line 45: What each upload replaces, so files dropped from a folder also disappear from the repo.
  • by_split(df) · line 50: The big-move model’s time split (decision 0007), by the row’s year.
  • render(template, values) · line 57: A card template with its {placeholders} filled in (an unknown one raises KeyError).
  • pct(v, digits) · line 62
  • share(v, digits) · line 66
  • card_values(owner) · line 70: Every number the three cards show, read from the run’s outputs.
  • stage_dataset(values) · line 110
  • stage_model(values) · line 141
  • stage_space(values) · line 156: The Space is a page that embeds the hosted dashboard (decision 0013).
  • listing(folder) · line 165
  • main() · line 170

Connections

Uses: src/common/contracts.py, src/common/settings.py, src/common/study.py, src/eventstudy/car.py, src/eventstudy/charts.py, src/eventstudy/stats.py, src/hosting/live.py, src/hosting/snapshot.py Used by: tests/test_hosting.py

Source

src/hosting/publish_hf.py