Get started with onnxruntime-web CDN

MIT licensed

Lightweight JS library: Run ONNX models in browsers with ONNXRuntime-web.

Tags:
  • ONNX
  • ONNXRuntime
  • ONNX Runtime

Stable version

Copied!

How to start using onnxruntime-web CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with onnxruntime-web CDN - cdnhub.io</title>
  <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@3.12.0/dist/tf.min.js"></script>
  <script src="https://cdn.cdnhub.io/onnxruntime-web/1.17.1/ort.min.js"></script>
</head>
<body>
  <button id="inference-button">Run Inference</button>
  <script>
    const ort = await ort.inferRuntime();
    const modelUrl = 'model.onnx';

    async function loadModel() {
      const model = await ort.loadModel(modelUrl);
      return model;
    }

    async function runInference() {
      const model = await loadModel();
      const input = tf.tensor2d([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]);
      const output = await model.executeAsync({ input: input });
      console.log(output);
    }

    document.getElementById('inference-button').addEventListener('click', runInference);
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions

1.10.0 1.10.0-dev.20211118-1aa21df14 1.10.0-dev.20211122-bcc6ab29f 1.10.0-dev.20211124-a3ebc5e08 1.10.0-dev.20211211-d0b08af37 1.11.0 1.11.0-dev.20211216-44c701192 1.11.0-dev.20211218-bd4fb4c5d 1.11.0-dev.20211222-05d20343e 1.11.0-dev.20211224-f780f0624 1.11.0-dev.20211230-d5742f3a4 1.11.0-dev.20220124-3dfadf903 1.11.0-dev.20220129-baa176792 1.11.0-dev.20220217-8d06e5a9d 1.11.0-dev.20220220-4d3cd2f68 1.11.0-dev.20220228-eb116595d 1.11.0-dev.20220318-b713855a9 1.12.0 1.12.0-dev.20220429-49d7050b8 1.12.0-dev.20220505-084165c74 1.12.0-dev.20220510-3437967e6 1.12.0-dev.20220516-c556f5f22 1.12.0-dev.20220517-4dd3cc40c 1.12.0-dev.20220520-e3a2d5cca 1.12.0-dev.20220607-40d2c98e4 1.12.0-dev.20220614-f6d2b629a 1.12.0-dev.20220707-62226d030 1.12.0-dev.20220708-c6732c079 1.12.1 1.13.0-dev.20220808-bdd6b00c9 1.13.0-dev.20220812-95f2a3e7e 1.13.0-dev.20220904-ac4f1bf96 1.13.0-dev.20220927-94e34ace1 1.13.0-dev.20221001-0cf17b192 1.13.0-dev.20221007-f4b944e1a 1.13.1 1.14.0 1.14.0-dev.20221124-4ca62b9ee8 1.14.0-dev.20230119-b51415b0ea 1.15.0 1.15.0-dev.20230131-e2dd1315c7 1.15.0-dev.20230206-b8fb9320ac 1.15.0-dev.20230212-12d91173c4 1.15.0-dev.20230317-e42f7487df 1.15.0-dev.20230411-0fbf715824 1.15.0-dev.20230412-e1e8852213 1.15.0-dev.20230430-31e7d3d7d4 1.15.0-dev.20230502-abdd4f518a 1.15.1 1.16.0 1.16.0-dev.20230508-045c623415 1.16.0-dev.20230521-0204594f90 1.16.0-dev.20230606-f013965831 1.16.0-dev.20230704-d540c7da0f 1.16.0-dev.20230820-cbaa008391 1.16.0-dev.20230905-8818a99c93 1.16.0-dev.20230907-0a3eb60b01 1.16.0-dev.20230908-29a818caa0 1.16.0-dev.20230908-a9df3aea72 1.16.0-dev.20230910-24f0893d3c 1.16.1 1.16.2 1.16.3 1.17.0 1.17.0-dev.20230920-e6301eee6a 1.17.0-dev.20230921-4f3f4366d5 1.17.0-dev.20230922-891fba3b9c 1.17.0-dev.20230925-216214b7d3 1.17.0-dev.20230926-bcc6205161 1.17.0-dev.20230929-561aca97cf 1.17.0-dev.20231009-60f19ab001 1.17.0-dev.20231014-ae211999dd 1.17.0-dev.20231031-8a574b874c 1.17.0-dev.20231031-95f053c652 1.17.0-dev.20231101-69f029797d 1.17.0-dev.20231102-178f7caaeb 1.17.0-dev.20231103-1439da36fe 1.17.0-dev.20231118-9364c05170 1.17.0-dev.20231128-a6d8726407 1.17.0-dev.20231129-38b640c797 1.17.0-dev.20231214-b42d4b8ea6 1.17.0-dev.20231215-81ad1e6ac3 1.17.0-dev.20231220-8931854528 1.17.0-dev.20240103-1c2dca95d8 1.17.0-dev.20240109-ab897a4a40 1.17.0-dev.20240110-5f3113ecd6 1.17.0-dev.20240111-d0bac8216d 1.17.0-dev.20240116-80f274ca6f 1.17.0-dev.20240118-a63b71eadb 1.17.1 1.17.3 1.18.0 1.18.0-dev.20240118-28a16c223c 1.18.0-dev.20240124-d7aebf9ea8 1.18.0-dev.20240126-fc44f96ad5 1.18.0-dev.20240130-9f68a27c7a 1.18.0-dev.20240309-efad5bbc5a 1.18.0-dev.20240311-5479124834 1.18.0-dev.20240424-218b6b0a73 1.18.0-dev.20240425-21b3cbc3af 1.18.0-dev.20240426-b842effa29 1.18.0-dev.20240427-736cbb3925 1.18.0-dev.20240429-3e4db2c686 1.18.0-dev.20240430-204f1f59b9 1.18.0-esmtest.20240411-1abb64e894 1.18.0-esmtest.20240428-624c681c83 1.19.0 1.19.0-dev.20240430-b2481e3602 1.19.0-dev.20240501-7a7344dcc2 1.19.0-dev.20240502-030a9611c2 1.19.0-dev.20240502-0dda8b0c44 1.19.0-dev.20240504-38412b68c6 1.19.0-dev.20240505-a36692066d 1.19.0-dev.20240509-69cfcba38a 1.19.0-dev.20240510-e124cf8e76 1.19.0-dev.20240515-2a17958b34 1.19.0-dev.20240521-068bb3d5ee 1.19.0-dev.20240531-35697d2421 1.19.0-dev.20240531-67bc9438d7 1.19.0-dev.20240601-217b66fd85 1.19.0-dev.20240601-5ec7ac80c7 1.19.0-dev.20240604-3dd6fcc089 1.19.0-dev.20240608-bd61ae530b 1.19.0-dev.20240611-ae4a2e6b3f 1.19.0-dev.20240612-94aa21c3dd 1.19.0-dev.20240618-5e81fa8aec 1.19.0-dev.20240621-69d522f4e9 1.19.0-dev.20240627-587e92c279 1.19.0-dev.20240629-56b36a58ba 1.19.0-dev.20240629-8c2689877f 1.19.0-dev.20240702-7be1d4aad3 1.19.0-dev.20240703-f39ee14b46 1.19.0-dev.20240704-07c429191e 1.19.0-dev.20240705-83e0c6b96e 1.19.0-dev.20240711-0a1178add9 1.19.0-dev.20240711-88336ffa92 1.19.0-dev.20240713-281ed8c12d 1.19.0-dev.20240724-b04adcc381 1.19.0-dev.20240725-ca47f0fdd3 1.19.0-dev.20240726-278f0f5cd2 1.19.0-dev.20240727-1ce160883f 1.19.0-dev.20240727-a4d3a1ce0c 1.19.0-dev.20240730-530a2d7b41 1.19.0-dev.20240801-4b8f6dcbb6 1.19.0-dev.20240804-ee2fe87e2d 1.19.0-esmtest.20240430-c7edbcc63d 1.19.0-esmtest.20240513-a16cd2bd21 1.19.0-esmtest.20240617-ac9f052070 1.19.0-esmtest.20240618-d229c160 *** 1.19.2 1.20.0-dev.20240809-f4ec85259a 1.20.0-dev.20240810-6ae7e02d34 1.20.0-dev.20240811-154084efaa 1.20.0-dev.20240814-a0708a0d96 1.20.0-dev.20240815-8a59b4dc4b 1.20.0-dev.20240816-b2d603abda 1.20.0-dev.20240816-d79e3c5791 1.20.0-dev.20240818-417aa00406 1.20.0-dev.20240818-c4ade796d6 1.20.0-dev.20240820-1fb2e71ddc 1.20.0-dev.20240821-009209e016 1.20.0-dev.20240822-ff3e8b02c3 1.20.0-dev.20240827-1d059b8702 1.20.0-dev.20240827-5d54dc1462 1.20.0-dev.20240829-be76e1e1b8 1.20.0-dev.20240902-b1ae43cbcb