Skip to content

Simple CDN usage? #20

@josephrocca

Description

@josephrocca

This looks interesting! Is there a simple way to use it via a CDN? esm.sh generally works fine, so I assumed this would work, but if I run it, I get an error:

let { Gliner } = await import("https://esm.sh/gliner@0.0.18");
const gliner = new Gliner({
  tokenizerPath: "onnx-community/gliner_small-v2.1",
  onnxSettings: {
    modelPath: "https://huggingface.co/onnx-community/gliner_small-v2.1/resolve/main/onnx/model_q4f16.onnx",
    executionContext: "web",
    executionProvider: "wasm",
  },
  maxWidth: 12,
});

await gliner.initialize();

const input_text = "Your input text here";
const texts = [input_text];
const entities = ["city", "country", "person"];
const threshold = 0.1;

const decoded = await gliner.inference({ texts, entities, threshold });
console.log(decoded);

The error:

ort-wasm-simd-threaded.mjs:1 Uncaught (in promise) TypeError: fi[f] is not a function
    at Xd (ort-wasm-simd-threaded.mjs:1:12799)
    at ort-wasm-simd-threaded.wasm:0x3e9ba7
    at Or (ort-wasm-simd-threaded.mjs:1:6879)
    at ua (ort-wasm-simd-threaded.mjs:1:22040)
    at f (ort-wasm-simd-threaded.mjs:1:22261)
    at ae (ort-wasm-simd-threaded.mjs:1:3294)
    at ort-wasm-simd-threaded.mjs:1:18647

I'm not able to use WebGPU because it's not yet available on Chrome Linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions