React + Vite + TypeScript frontend for browsing AgML datasets and benchmark results. Uses Tailwind CSS, React Router v6, TanStack Table, and Recharts.
- Dataset browser — Filter by ML task, agricultural task, platform; search by name; link to dataset detail pages.
- Leaderboard — Benchmark table with task filter, dataset search, sortable columns; bar chart view; dataset names link to detail pages; mAP50 column for detector rows; precision/recall in row tooltip.
- Responsive layout — Stacked filters on small screens; touch-friendly chips and controls; horizontal scroll for wide table.
- Accessibility — Skip-to-main link; ARIA on table (sort, scope, caption); keyboard-accessible MultiSelectDropdown; visible focus rings.
- Contribute section — Landing page includes a call-to-action to contribute datasets, linking to the AgML contribution guide.
- Typography: Plus Jakarta Sans (Google Fonts).
- Colors: Slate-based palette (ink, paper, muted, accent teal).
- Surfaces: Rounded cards with soft shadows; buttons and inputs use consistent radii and focus states.
- Node.js (v18+ recommended) and npm
- AgML source — The repo must be cloned next to this app so the build can generate
datasets.jsonandleaderboard.jsonfrom AgML’s docs and assets. By default the scripts look for../agml-source(i.e.agml-sourcenext to thefrontendfolder).
cd frontend
npm installDataset and leaderboard data are not checked in as source; they are produced at build time from the AgML repo:
public/datasets.json— Generated by parsingagml-source/docs/datasets/*.md(dataset metadata tables and example image URLs).public/leaderboard.json— Generated by mergingagml-source/agml/_assets/model_benchmarks.jsonanddetector_benchmarks.json.
To point at a different AgML root (e.g. not ../agml-source), set AGML_SOURCE when running the generator or build:
AGML_SOURCE=/path/to/agml-repo node scripts/generate-datasets.js
AGML_SOURCE=/path/to/agml-repo node scripts/generate-leaderboard.jsOr run the full prebuild with the same env:
AGML_SOURCE=/path/to/agml-repo npm run prebuildThe app loads data at runtime via publicUrl() so datasets.json and leaderboard.json resolve correctly for any Vite base (including subpath deployment).
| Script | Description |
|---|---|
npm run dev |
Start Vite dev server (e.g. http://localhost:5173). Uses existing public/datasets.json and public/leaderboard.json; run prebuild first if they’re missing or stale. |
npm run prebuild |
Generate public/datasets.json and public/leaderboard.json from the AgML repo. Run from frontend/ with agml-source at ../agml-source (or set AGML_SOURCE). |
npm run build |
Run prebuild (via npm lifecycle), then TypeScript check and Vite production build. Output in dist/. |
npm run preview |
Serve the dist/ build locally. |
npm run lint |
Run ESLint. |
src/pages/— Landing, DatasetBrowser, DatasetDetail (/datasets/:name), Leaderboard.src/components/— Header, LeaderboardChart, MultiSelectDropdown.src/lib/—useDatasets,filterDatasets,publicUrl(base-path-aware asset URLs).src/data/types.ts— TypeScript types forDatasetandLeaderboardRow.scripts/— Build-time scripts:generate-datasets.js,generate-leaderboard.js.public/— Generated manifests and static assets; Vite serves these at the root (or underbase).
If the app is served from a subpath (e.g. https://user.github.io/AgML-Hub/), set base in vite.config.ts:
export default defineConfig({
base: '/AgML-Hub/', // match your deployment path
plugins: [react()],
})Without this, the leaderboard and dataset browser may show no data because the JSON assets are requested from the wrong path.
-
Ensure the AgML repo is at
../agml-source(or setAGML_SOURCE). -
From
frontend/, run:npm run prebuild
-
Start the app with
npm run dev(or runnpm run buildandnpm run preview). The UI loadsdatasets.jsonandleaderboard.jsonfrom the server.