Instructions to use nodd-repo/sentiment with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use nodd-repo/sentiment with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-classification', 'nodd-repo/sentiment');
Model card: @nodd 0.2.0 API (import { nodd })
Browse files
README.md
CHANGED
|
@@ -44,13 +44,16 @@ npm install @nodd/browser # or @nodd/node on a server
|
|
| 44 |
```
|
| 45 |
|
| 46 |
```ts
|
| 47 |
-
import {
|
| 48 |
|
| 49 |
-
const m = await
|
| 50 |
const d = await m.decide("..."); // { label, probabilities, confidence, ... }
|
| 51 |
-
if (!m.isConfident(d)) { /* escalate */ }
|
|
|
|
| 52 |
```
|
| 53 |
|
|
|
|
|
|
|
| 54 |
## Files
|
| 55 |
|
| 56 |
- `onnx/model_quantized.onnx`: int8 model used by default; `onnx/model.onnx`: fp32 (`dtype: "fp32"`)
|
|
|
|
| 44 |
```
|
| 45 |
|
| 46 |
```ts
|
| 47 |
+
import { nodd } from "@nodd/browser"; // or "@nodd/node": same API, reads the folder from disk
|
| 48 |
|
| 49 |
+
const m = await nodd.load("/models/sentiment/v1");
|
| 50 |
const d = await m.decide("..."); // { label, probabilities, confidence, ... }
|
| 51 |
+
if (!m.isConfident(d)) { /* below the calibrated threshold: escalate */ }
|
| 52 |
+
m.dispose(); // stops the worker
|
| 53 |
```
|
| 54 |
|
| 55 |
+
Needs `@nodd/browser` / `@nodd/node` ≥ 0.2.0.
|
| 56 |
+
|
| 57 |
## Files
|
| 58 |
|
| 59 |
- `onnx/model_quantized.onnx`: int8 model used by default; `onnx/model.onnx`: fp32 (`dtype: "fp32"`)
|