Download scripts/generate-examples.ts from new-human/price-bot: direct link, hf CLI and curl.
- Browser
- Download file 783 Bytes
-
https://huggingface.co/spaces/new-human/price-bot/resolve/main/scripts/generate-examples.ts
- Command line
-
hf download hf://spaces/new-human/price-bot/scripts/generate-examples.ts
-
curl -L -o generate-examples.ts https://huggingface.co/spaces/new-human/price-bot/resolve/main/scripts/generate-examples.ts
783 Bytes
| import fs from "fs/promises"; | |
| import path from "path"; | |
| import { compareItems } from "../src/core/pipeline.js"; | |
| import type { RawProductItem } from "../src/types.js"; | |
| const root = process.cwd(); | |
| const capturedAt = "2026-04-03T10:00:00.000Z"; | |
| const datasetPath = path.join(root, "examples", "sample-dataset.json"); | |
| const outPath = path.join(root, "examples", "sample-output.json"); | |
| const s = await fs.readFile(datasetPath, "utf-8"); | |
| const data = JSON.parse(s) as { items: Omit<RawProductItem, "capturedAt">[] }; | |
| const rawItems: RawProductItem[] = data.items.map((x) => ({ ...x, capturedAt })); | |
| const { items } = compareItems(rawItems, { dedupe: "platform" }); | |
| await fs.writeFile(outPath, `${JSON.stringify({ items }, null, 2)}\n`, "utf-8"); | |
| process.stdout.write(`${outPath}\n`); | |