Spaces:
Running
Running
Download predict_driver.mjs from WideChaos/tiny-hash-intent: direct link, hf CLI and curl.
- Browser
- Download file 605 Bytes
-
https://huggingface.co/spaces/WideChaos/tiny-hash-intent/resolve/main/predict_driver.mjs
- Command line
-
hf download hf://spaces/WideChaos/tiny-hash-intent/predict_driver.mjs
-
curl -L -o predict_driver.mjs https://huggingface.co/spaces/WideChaos/tiny-hash-intent/resolve/main/predict_driver.mjs
605 Bytes
| 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 }; | |
| } | |
| }), | |
| ), | |
| ); | |