File size: 605 Bytes
a2bd61d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import fs from "node:fs";
import { parseModel, predict, features } from "./inference.mjs";
const model = parseModel(
  fs.readFileSync(
    new URL("./run-001/model-int8.json", import.meta.url),
    "utf8",
  ),
);
const cases = JSON.parse(fs.readFileSync(0, "utf8"));
console.log(
  JSON.stringify(
    cases.map((input) => {
      try {
        return {
          input,
          features: features(input),
          raw: predict(model, input, false),
          calibrated: predict(model, input, true),
        };
      } catch (e) {
        return { input, error: e.message };
      }
    }),
  ),
);