Spaces:
Sleeping
Sleeping
|
Download documents/ENCYCLOPEDIA.md from lucashudsn/wavereader: direct link, hf CLI and curl.
- Browser
- Download file 3.34 kB
-
https://huggingface.co/spaces/lucashudsn/wavereader/resolve/main/documents/ENCYCLOPEDIA.md
- Command line
-
hf download hf://spaces/lucashudsn/wavereader/documents/ENCYCLOPEDIA.md
-
curl -L -o ENCYCLOPEDIA.md https://huggingface.co/spaces/lucashudsn/wavereader/resolve/main/documents/ENCYCLOPEDIA.md
3.34 kB
A newer version of the Gradio SDK is available: 6.31.0
Encyclopedia tab
The encyclopedia tab in app/ui.py:build_demo() is the break browser.
It reads the generated knowledge base, filters it, plots it, and feeds
the selected break to the surf forecast tab via shared gr.State.
Data source
data/australia-surf-breaks-enriched.jsonβload_breaks()(app/breaks_data.py) intoDF. Legacy{"name | state | region": {...}}dict format is accepted; rows with anerrorcolumn are dropped.- Derived at import time:
STATES,REGIONS_BY_STATE,ALL_REGIONS,SKILLS(filtered toSKILL_ORDER: beginner β intermediate β advanced β expert β pro-only). - Enriched
idis"<name> | <state> | <region>". Canonicalstate/regioncome from the input list, never the model.
Filtering
filter_breaks(df, state, region, skill) β "All" / None means no
filter, comparison is case-insensitive on state / region /
skillLevel.
state_dd.changeβupdate_region_choices(narrows region list) βupdate_mapβsync_custom_from_filters(pushes map State/Region into the generation form;Allleaves the field untouched viagr.skip()).region_dd/skill_ddβupdate_map.
update_map returns (map fig, break choices, records, count, empty details). Unfiltered view frames the whole of Australia
(AUSTRALIA_CENTER, zoom 3.5); otherwise the map auto-centers/zooms via
_zoom_for_span().
Map
build_map(records, default_view)β PlotlyScattermap,open-street-mapstyle, marker colour bySKILL_COLORS. Point order matches records order so the break list lines up.build_map_with_custom(base_records, custom)β adds the gold star (#FFD700) marker for the session break._lat()/_lng()returnNoneon missing coords; those points are skipped for centering.
Details + selection
break_dd(Radio,.break-list) βon_break_pickβbreak_to_table(record), a 16-row Field/Value dataframe (name/state/region/description/skill/break+peak type/coords/ideal swell+wind+tide/season/hazards/crowd)._resolve_pick(label, base_records, custom)maps the label back to its record; the custom break carries aβ (your break)suffix and matches by suffix, base records match byname.on_break_pickalso sets sharedselected_breakstate and updates the forecast tab header + skill default (break's ownskillLevel, validated againstSKILL_ORDER, fallbackintermediate).
Session-only custom break
generate_custom_break()(inapp/custom_break.py) streams(telemetry, details, map, dropdown, state)tuples viayield. Lazyfrom app import generate_surf_break(direct package import, noimportlibshims).- Empty custom state/region fields fall back to the main map filters;
explicit values win. Exactly one custom break per session (
gr.State, never written to disk); regeneration replaces it. clear_custom_break(base_records, selected)deletes it; if the deleted break was the forecast selection, the forecast header/skill reset too.clear/generatedo not auto-select the forecast state β pick the break in the list first, then fetch on tab 2.
Theme
Lo-fi via APP_CSS: light blue bg #d6e9f8, dark blue #0b2c5c,
Courier. Don't restyle without asking. Callbacks stay wired in
build_demo().